Introduction
High-quality network traces are essential for developing robust security tools, optimizing traffic prioritization, and performing deep packet analysis. However, the networking community faces a persistent data bottleneck. Privacy regulations, the rapid evolution of protocols, and the sheer volume of modern traffic make obtaining and sharing real-world datasets increasingly difficult.
Existing synthetic traffic generators have historically fallen into two categories, both with significant drawbacks. Coarse-grained generators produce high-level flow statistics but fail to capture the raw byte-level nuances required for deep analysis. Conversely, fine-grained generators, such as those based on Diffusion models, often produce "noisy" outputs that violate strict protocol structures, requiring complex post-processing heuristics. While Transformer-based models (e.g., TrafficGPT) offer better structural fidelity, their quadratic scaling with sequence length limits them to generating very short traffic bursts. This paper explores the application of Mamba, a selective structured State Space Model (SSM), to overcome these limitations by modeling network traffic as a long-sequence generation problem.
Methodology: Mamba for Network Sequences
The researchers propose a novel workflow that treats raw packet bytes as tokens in a sequence, similar to how Large Language Models (LLMs) treat words.
Data Representation and Tokenization
To prepare the data, raw PCAP files are first decomposed into individual bidirectional flows. The model operates directly on the raw bytes of these flows. Each byte (decimal values 0-255) is treated as a unique token. To provide the model with structural context, the authors introduce special control tokens:
<|pkt|>: Marks the boundaries between individual packets within a flow.<|LABEL|>: Prepended to the sequence to define the application type (e.g., Zoom, Netflix, or Twitter), allowing for class-conditional generation.
Model Architecture
The core of the approach is the Mamba architecture. Unlike the self-attention mechanism in Transformers, which has $O(N^2)$ complexity, Mamba’s SSM-based architecture scales linearly ($O(N)$) with sequence length. This efficiency is critical for network traffic, where a single session can encompass thousands of packets and tens of thousands of byte-tokens. The model is trained using a standard next-token prediction task, effectively learning the "grammar" of network protocols through unsupervised learning.
Experimental Setup
The model was trained on a curated service-classification dataset comprising approximately 28 GiB of raw data across 28,000 flows. The data was aggregated from three primary categories:
- Video Streaming: YouTube, Netflix.
- Video Conferencing: Zoom, Microsoft Teams.
- Social Media: Facebook, Twitter.
DNS filtering was employed during the curation process to ensure the dataset contained only relevant application-layer traffic, removing background noise and unrelated system calls.
Key Results and Discussion
Statistical Fidelity
The Mamba-based generator was evaluated against current state-of-the-art (SOTA) models using Jensen-Shannon Divergence (JSD), Total Variation Distance (TVD), and Hellinger Distance (HD). In terms of statistical similarity to real-world traffic, the Mamba model achieved a JSD of 0.02, significantly outperforming NetDiffusion (0.04) and the Transformer-based TrafficGPT (0.16). This suggests that the SSM architecture is exceptionally capable of capturing the underlying distribution of packet fields and sizes.
Scalability and Sequence Length
A primary advantage of the SSM approach is its generation capacity. The researchers demonstrated that Mamba could generate traces up to 1,081 packets long (approximately 66,000 tokens). This represents a 5.5x increase in sequence length compared to previous fine-grained generators, which typically struggle to maintain coherence beyond a few dozen packets. Furthermore, the model achieved this without the need for manual correction heuristics, naturally learning to respect protocol boundaries.
Generalization vs. Memorization
To ensure the model was not simply memorizing the training set, the authors analyzed the uniqueness of the generated output. They found that 99% of the generated packets were unique from the training seeds. While critical protocol fields (like IP versions) remained consistent, the model introduced realistic variations (averaging a 6.5% byte difference) in non-essential payload areas, indicating true generative learning rather than rote replication.
Limitations and Future Directions
Despite its success in byte-level synthesis, the current iteration of the model faces several challenges:
- Temporal Modeling: The model currently generates packet contents but does not predict Inter-Arrival Times (IAT). Future iterations must incorporate timestamps to be useful for latency-sensitive simulations.
- Hard Protocol Constraints: As a probabilistic model, Mamba may occasionally generate invalid values (e.g., an impossible header field). Integrating hard-coded protocol constraints into the decoding process is a priority for future work.
- Downstream Utility: The ultimate test for synthetic data is its performance in training secondary tools. The researchers plan to validate these traces by using them to train anomaly detectors and traffic classifiers to see if they achieve parity with real-world data.
Conclusion
This research demonstrates that State Space Models like Mamba offer a superior alternative to Transformers and Diffusion models for fine-grained network traffic generation. By combining linear scaling with high statistical fidelity, this approach paves the way for generating long-duration, high-fidelity synthetic traces that can alleviate the data scarcity issues currently facing the networking research community.
Summary updated