Data Augmentation for Traffic Classification

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

Introduction

Traffic Classification (TC) is a fundamental task in network management, enabling operators to identify applications—such as YouTube, WhatsApp, or Zoom—to optimize bandwidth and ensure security. Historically, this was achieved through Deep Packet Inspection (DPI). However, the widespread adoption of encryption protocols like TLS and HTTPS has rendered payload-based inspection largely ineffective.

In response, researchers have turned to Deep Learning (DL) to classify traffic based on statistical patterns in packet sizes and timing. Despite its promise, DL for networking faces a significant bottleneck: the scarcity of high-quality, labeled datasets. Network data is often imbalanced and expensive to annotate. While fields like Computer Vision use Data Augmentation (DA) to synthesize training samples, its application in networking has remained under-explored due to the complex chronological nature of network flows.

Data Representation and Methodology

The authors propose a systematic framework for applying DA to encrypted traffic. They represent each network flow as a 2D tensor where $D$ represents the number of packet features (e.g., size, direction, inter-arrival time) and $T$ represents the number of packets per feature.

Representation of network traffic as a 2D tensor of features (D) and packets (T).

The study benchmarks 18 different augmentation functions categorized into three primary families:

  1. Amplitude: These techniques add noise or scale values, such as jittering packet sizes or Inter-Arrival Times (IAT).
  2. Masking: These functions randomly "black out" specific packets or features to simulate data loss or measurement errors.
  3. Sequence: These transformations reorder, duplicate, or shift segments of the packet series, mimicking network phenomena like retransmissions.

Amplitude and Masking Transformations

Amplitude transformations, such as Gaussian Noise and Spike Noise, modify the feature values $x_{(d,t)}$ by adding independently sampled noise. Masking techniques, on the other hand, set certain values to zero based on Bernoulli distributions or window-based sampling.

Examples of Amplitude-based data augmentation techniques, including Gaussian and Spike noise.

Integration Strategies

Beyond the transformations themselves, the paper explores how to integrate augmented samples into the training process via three Batching Policies:

  • Replace: Original samples are swapped for augmented ones.
  • Inject: The batch size is doubled by adding an augmented version of every original sample, providing the model with both a stable reference and a noisy variation.
  • Pre-augment: The entire dataset is expanded before training begins.

Experimental Results and Insights

The study utilized three datasets: MIRAGE-19 (Android apps), MIRAGE-22 (IoT/Video conferencing), and a massive Enterprise dataset (2.9 million flows). The results yielded several critical insights:

  • Performance Gains: DA consistently improved classification, providing a boost of up to +4.4% in weighted F1-score on the MIRAGE-19 dataset.
  • Sequence is King: Transformations that respect network dynamics—such as Translation (shifting segments) and Permutation (reordering segments)—outperformed simple amplitude noise. This suggests that the chronological order of packets carries more semantic weight than exact feature values.
  • The "Inject" Advantage: The Inject policy proved most effective, as it allows the model to learn from variations without losing sight of the original data distribution.
  • Domain Constraints: Unlike image processing, certain augmentations like Horizontal Flip (reading a flow backward) are disastrous for networking because they violate the strict chronological handshake of network protocols.

Conclusion and Future Work

This benchmark demonstrates that well-chosen data augmentation can significantly enhance the robustness of traffic classifiers. The findings suggest that future research should move away from hand-crafted rules toward automated approaches. Potential directions include using Generative Adversarial Networks (GANs) or Diffusion Models to automatically learn the optimal "sweet spot" for augmentation, as well as testing these techniques on newer architectures like Transformers.

Summary updated

BibTeX
@inproceedings{wang2024data,
  author = {Chao Wang and Alessandro Finamore and Pietro Michiardi and Massimo Gallo and Dario Rossi},
  title = {{Data Augmentation for Traffic Classification}},
  booktitle = {PAM},
  year = {2024},
  doi = {10.1007/978-3-031-56249-5\_7},
}
Figure