Towards a Graph-based Foundation Model for Network Traffic Analysis

Louis Van Langendonck, Ismael Castell-Uroz, Pere Barlet-Ros

TL;DR

Researchers have introduced a graph-based foundation model for network traffic analysis that is roughly 99% smaller than existing Transformer-based alternatives. By representing network traffic as a dynamic spatio-temporal graph and using self-supervised link prediction for pretraining, the model achieves an average performance boost of 6.87% in few-shot learning tasks like intrusion detection and botnet classification.

What Problem Does This Paper Address?

Foundation models (like GPT) have revolutionized NLP and computer vision, but applying them to computer networks is tricky. Current state-of-the-art approaches typically treat network packets like words in a sentence, using Large Language Model (LLM) architectures to process tokenized hex-level packet data.

The authors argue this "packet-as-text" approach has three major flaws:

  1. Structural Blindness: Sequential tokenization fails to capture the complex, non-linear relationships between different network elements.
  2. Inefficiency: Processing raw packet data is resource-intensive and often redundant, especially since encryption hides most useful payload information anyway.
  3. Model Bloat: These Transformer-based models are massive (hundreds of millions of parameters), making them impractical for real-time deployment in high-speed network environments.

Methods

The authors propose a shift from packet-level sequences to flow-level graphs.

  • Graph Representation: They use a "line-graph" approach where both network flows and IP addresses are represented as nodes. Spatial edges connect IPs to the flows they generate, while temporal edges connect recurring nodes across time windows (spanning a few seconds).
  • Architecture: The core is a spatio-temporal Graph Neural Network (GNN) built on the GraphSAGE framework. Because GNNs reuse parameters across the graph structure, the resulting model is incredibly lean—just 732,000 parameters compared to the 110M–770M parameters found in Transformer-based models.
  • Self-Supervised Pretraining: To teach the model the "grammar" of network traffic without needing labeled data, they use a link prediction task. The model is shown real connections and "fake" (randomly sampled) edges and must learn to distinguish between them. This forces the GNN to understand the typical spatial and temporal patterns of a network.
  • Finetuning: After pretraining, the model's weights are frozen or adjusted slightly while a simple classifier head is added to perform specific downstream tasks using very limited labeled data (few-shot learning).

Datasets

The study uses a diverse set of Netflow-based datasets to ensure the model generalizes across different environments:

  • Pretraining: Unlabeled versions of UNSW-NB15 and ToN-IoT.
  • Downstream Evaluation:
    • Intrusion Detection: BoT-IoT.
  • Traffic Classification: UPC-COMNET14 (a private dataset containing 77 different application labels).
  • Botnet Detection: CTU13.

Crucially, the pretraining and finetuning datasets are strictly separated to prove that the model learns general network dynamics rather than just memorizing a specific dataset.

Key Insights and Ideas

  • Flows over Packets: Aggregating packets into flows provides a clearer, more meaningful representation of network behavior, especially when dealing with encrypted traffic where individual packet payloads are opaque.
  • The Power of Geometry: GNNs are inherently better suited for network data because networks are graphs. This structural alignment allows the model to achieve high performance with a fraction of the parameters required by Transformers.
  • Link Prediction as a Foundation: The "aha moment" here is that predicting whether a connection should exist is a powerful enough proxy task to teach a model the underlying physics of network traffic.
  • Efficiency is a Feature: By being 1% the size of other foundation models, this approach opens the door for "edge" deployment—running sophisticated AI analysis directly on routers or switches rather than in a massive centralized data center.

Key Results

  • Performance Gain: Models finetuned from the pretrained base showed an average 6.87% improvement in F1-score and accuracy compared to models trained from scratch with the same limited data.
  • Faster Convergence: The loss curves show that pretrained models reach optimal performance significantly faster and more consistently across different tasks.
  • Extreme Compression: The model achieves these results with only ~0.73M parameters, while competing models like ET-BERT or Lens require 110M to 770M parameters.
  • Generalization: The model successfully transferred knowledge from the IoT-heavy pretraining data to general traffic classification and botnet detection tasks, proving it had learned "general network traffic dynamics."

Limitations and Future Work

While promising, the authors acknowledge this is a "proof of concept" for a graph-based foundation model.

  • Scaling: The current pretraining uses a relatively small amount of data. A true "foundation" model would need to be trained on much larger, more diverse datasets.
  • Task Variety: The authors suggest that combining link prediction with other self-supervised tasks (like node feature prediction) could make the model even more robust.
  • Architectural Refinement: Future versions may incorporate attention mechanisms into the GNN's message-passing steps to better capture long-range dependencies in the traffic graph.

Summary updated

BibTeX
@inproceedings{langendonck2024towards,
  author = {Louis Van Langendonck and Ismael Castell-Uroz and Pere Barlet-Ros},
  title = {{Towards a Graph-based Foundation Model for Network Traffic Analysis}},
  booktitle = {Gnnet@conext},
  year = {2024},
  doi = {10.1145/3694811.3697817},
}
Figure