TRACE: Topological Representations for Anomaly detection through Contrastive Embeddings

Sydney JohnsarXiv 2026 · arXiv

TL;DR

TRACE is a new framework for intrusion detection that learns to identify cyber-attacks by understanding the "shape" of normal system activity. By combining graph neural networks with topological data analysis in a contrastive learning setup, it detects anomalies based on structural deviations without requiring massive libraries of labeled attack data.

What Problem Does This Paper Address?

Modern intrusion detection faces a "closed-world" problem: supervised machine learning models are excellent at catching known attacks but often fail when faced with evolving "zero-day" threats. Labeled attack data is expensive to produce and quickly becomes obsolete.

Furthermore, standard Graph Neural Networks (GNNs) typically focus on local neighborhoods—what a specific node and its immediate neighbors are doing. However, many sophisticated attacks (like lateral movement or coordinated botnets) manifest as changes in the global "topology" or connectivity of a system. A single event might look benign locally, but its role in a larger interaction pattern reveals its malicious nature. The authors aim to bridge this gap by creating a detector that is both label-efficient and sensitive to global structural changes.

Methods

The authors introduce TRACE (Topological Representations for Anomaly detection through Contrastive Embeddings). The framework follows a four-step pipeline:

  1. Graph Representation: System activity is modeled as a graph where nodes are entities (processes, files, hosts) and edges are interactions (system calls, network traffic).
  2. Dual-Channel Contrastive Learning: TRACE trains only on benign data using two parallel channels:
  3. Graph-Structure Channel: Uses a Graph Isomorphism Network (GIN) to capture local attributed neighborhoods.
  4. Topology Channel: Computes topological summaries (based on node degree and closeness) across multiple scales to capture the overall "shape" of the graph.
  5. Shared Embedding Space: The model uses a contrastive objective (InfoNCE) to ensure that different "views" of the same benign graph are mapped close together in a projected embedding space.
  6. Anomaly Scoring: During inference, a test graph is embedded into this same space. Its anomaly score is calculated as the average distance to its $k$-nearest neighbors in the benign training set. If the distance exceeds a threshold (calibrated using a small validation set), it is flagged as an intrusion.
Fig. 1: Overview of TRACE. The top row shows contrastive training. Activity graphs are augmented into graph and topology views, encoded, projected, and optimized with a contrastive objective. The bottom row shows inference. Each graph is scored by distance to the non-malicious reference memory and classified using a validation-selected threshold.

Datasets

The authors evaluated TRACE on three distinct graph-based security benchmarks:

  • StreamSpot: Heterogeneous system-activity provenance graphs representing relationships among system entities.
  • GraSec-IoT: Graph snapshots from an Internet of Things environment, including communication and attack behavior.
  • Unicorn Wget: System activity collected from a specific Wget-based attack scenario.

Key Insights and Ideas

  • Topology as a Security Signal: The core "aha moment" is that global connectivity patterns (branches, paths, mergers) provide a complementary signal to local message passing. This is particularly useful when malicious and benign graphs share similar local attributes but differ in how those attributes are organized.
  • Consistency in the Embedding Space: Unlike many contrastive methods that discard the "projection head" after training, TRACE performs anomaly scoring in the exact same projected space optimized during training. This prevents a mismatch between what the model learned and how it is being used to detect anomalies.
  • The Limits of Supervision: Interestingly, TRACE outperformed a supervised GNN on the Unicorn Wget dataset. This suggests that when an attack is highly specific or different from training examples, learning the "boundary of normal" is more robust than trying to learn the "boundary of known attacks."

Key Results

TRACE demonstrated strong, albeit mixed, performance across the benchmarks:

  • Superiority over GraphCL: TRACE significantly outperformed the standard GraphCL (which lacks the topology channel) on StreamSpot (F1 0.923 vs 0.450) and Unicorn Wget (F1 0.583 vs 0.203).
  • Supervised Comparison: While a supervised GNN generally led on StreamSpot and GraSec-IoT, TRACE achieved the highest F1 score on Unicorn Wget (0.583 vs 0.367 for the supervised model).
  • Dataset Sensitivity: TRACE performed worse than the baseline on GraSec-IoT (F1 0.790 vs 0.975), indicating that the utility of topological summaries depends heavily on the specific graph construction and attack type.
TABLE I: Intrusion detection performance across three graph-based security datasets. The supervised GNN uses labeled attacks during training. GraphCL and TRACE are benign-only representation learning methods.

Limitations and Future Work

  • Thresholding Labels: Although the representation learning is "benign-only," the authors still used a labeled validation set to pick the optimal anomaly threshold. A truly label-free system would need a different calibration strategy.
  • Static Reference: The current model uses a fixed reference memory of benign graphs. In real-world deployments, "normal" behavior drifts over time, requiring online adaptation.
  • Localization: TRACE identifies that a graph is anomalous but does not yet point to the specific nodes or edges responsible for the alert, which is critical for security analysts performing triage.
  • Adversarial Attacks: The study does not evaluate how TRACE handles "structural adversarial attacks"—malicious graphs specifically designed to mimic the topological signature of benign activity.

Summary updated

Abstract

Intrusion detectors must recognize evolving malicious behavior even when confirmed attack labels are scarce or incomplete. We present TRACE, a topology-aware graph contrastive learning framework for label-efficient intrusion detection. TRACE learns from benign system-activity graphs by combining message-passing and topological representations, then assigns anomaly scores in the same projected embedding space optimized by the contrastive objective. This design captures both local interactions and graph-scale structural deviations without using attack labels during representation learning. A labeled validation set containing benign and malicious graphs is used only to calibrate the anomaly threshold. We evaluate TRACE on StreamSpot, GraSec-IoT, and Unicorn Wget against a supervised graph neural network and the benign-only GraphCL baseline. TRACE obtains F1 scores of 0.923, 0.790, and 0.583, respectively. Compared with GraphCL, this is higher on StreamSpot (0.450) and Unicorn Wget (0.203), but lower on GraSec-IoT (0.975). The supervised model leads on StreamSpot and GraSec-IoT, whereas TRACE has the highest F1 on Unicorn Wget. The mixed results show that topology-aware benign-only learning can improve detection in some graph settings but does not provide a uniform advantage.
BibTeX
@misc{johns2026trace,
  author = {Sydney Johns},
  title = {{TRACE: Topological Representations for Anomaly detection through Contrastive Embeddings}},
  year = {2026},
  eprint = {2611.21548},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.21548},
}
Figure