NetSSM: Multi-Flow and State-Aware Network Trace Generation using State-Space Models

Andrew Chu, Xi Jiang, Shinan Liu, Arjun Nitin Bhagoji, Francesco Bronzino, Paul Schmitt, Nick Feamster

TL;DR

NetSSM is a novel raw network traffic generator that leverages State Space Models (specifically the Mamba-2 architecture) to synthesize high-fidelity packet traces. Unlike previous methods, it excels at capturing long-duration stateful communications and complex multi-flow interactions, producing traces up to 78× longer than existing transformer-based generators while maintaining strict protocol compliance.

What Problem Does This Paper Address?

In the world of computer networking, raw traffic data (PCAPs) is the "gold standard" for security analysis and performance modeling. However, this data is notoriously difficult to obtain due to strict privacy regulations (GDPR/CCPA) and the high cost of large-scale collection.

To fill this gap, researchers use synthetic data generators. But existing tools face a "Goldilocks" problem:

  1. Traffic Attribute Generators (like NetShare) produce high-level statistics but miss the "conversation" happening at the byte level.
  2. Raw Packet Generators (like NetDiffusion or TrafficGPT) capture byte-level detail but struggle with long sessions. They often "forget" the state of a connection after a few dozen packets and fail to model multi-flow sessions—where multiple interleaved connections (e.g., a browser fetching images, scripts, and ads simultaneously) interact.

NetSSM aims to bridge this gap by generating long, state-aware, multi-flow raw packet traces.

Methods

The researchers turned to State Space Models (SSMs), specifically the Mamba-2 architecture. While Transformers (the tech behind ChatGPT) are powerful, their "attention" mechanism scales quadratically, making them incredibly memory-hungry for long sequences. Mamba-2 scales linearly, making it a "natural fit" for the sequential, stateful nature of network protocols like TCP.

The NetSSM Pipeline: * Tokenization: Instead of complex NLP-style sub-word units, NetSSM uses a custom tokenizer that maps each raw byte (0-255) directly to a token ID. It also uses special tokens like <|pkt|> to mark packet boundaries and <|netflix|> to label the application. * Training: The model is trained using self-supervised next-token prediction. It learns the "grammar" of network protocols by predicting the next byte in a stream. * Context Window: By using SSMs, the authors trained the model with a context window of 100,000 tokens (roughly 943 packets)—more than 8× longer than prior work. * Generation: To start a trace, the model is "prompted" with the first few packets of a real session. It then autoregressively generates the rest of the conversation.

Datasets

The authors evaluated NetSSM using several diverse real-world datasets:

  • Multimedia Traffic: A collection of video streaming, conferencing, and social media traces (6.36 GiB to 17.36 GiB).
  • Netflix & YouTube Streaming: Large-scale datasets specifically used to test the model's ability to replicate complex video segment download patterns (DASH/HTTP).
  • Comparison Baselines: They compared NetSSM against NetShare (GAN-based), NetDiffusion (Diffusion-based), and TrafficGPT (Transformer-based).

Key Insights and Ideas

  • Recurrence over Attention: The "aha moment" here is that network traffic is more like a state machine than a natural language sentence. The recurrent nature of SSMs allows the model to maintain a "hidden state" that tracks the progress of a TCP handshake or a file transfer much more efficiently than a Transformer's attention window.
  • Multi-Flow Realism: This is the first generator to successfully tackle interleaved flows. In real networks, packets from different connections are mixed together. NetSSM learns to "juggle" these flows, maintaining the internal state of each connection even as they interleave.
  • Semantic Similarity: The authors argue that statistical similarity (matching byte distributions) isn't enough. They introduced "semantic" evaluation—checking if the generated traffic actually behaves like the target application (e.g., does it follow the specific "bursty" pattern of a Netflix video download?).

Key Results

  • Superior Fidelity: NetSSM achieved an average Jensen-Shannon Divergence (JSD) of 0.05, significantly better than NetShare (0.18).
  • Downstream Utility: A machine learning classifier trained entirely on synthetic NetSSM data achieved 97% accuracy when tested on real-world ground truth data. For comparison, baselines like NetDiffusion only reached 16% accuracy.
  • Protocol Compliance: NetSSM's traces were remarkably "legal." It correctly followed TCP state transitions (handshakes, teardowns) and even replicated common real-world anomalies found in the training data without needing manual post-generation fixes.
  • Scale: It produced traces up to 78× longer than TrafficGPT, allowing it to model entire sessions rather than just the first few seconds of a connection.

Limitations and Future Work

  • The Timestamp Problem: Currently, NetSSM generates the content of packets but not their timing. Timestamps are currently sampled from a distribution post-generation. The authors acknowledge that learning timestamps in parallel with bytes is a major challenge due to the different "modalities" of the data (discrete bytes vs. continuous time).
  • Flow "Hallucinations": In some specific workloads (like YouTube), the model occasionally generated extra, tiny "hallucinated" flows that weren't in the original data.
  • Protocol Support: While it handles TCP, UDP, and DNS well, the pre-processor needs to be extended to support newer protocols like QUIC or RTP.

Overall, NetSSM represents a significant leap forward in making synthetic network data "useful" for real-world engineering and security tasks.

Summary updated

BibTeX
@article{chu2026netssm,
  author = {Andrew Chu and Xi Jiang and Shinan Liu and Arjun Nitin Bhagoji and Francesco Bronzino and Paul Schmitt and Nick Feamster},
  title = {{NetSSM: Multi-Flow and State-Aware Network Trace Generation using State-Space Models}},
  journal = {PACMNET},
  year = {2026},
  doi = {10.1145/3786289},
}

Loading related content...

Figure