KnowGraph: Knowledge-Enabled Anomaly Detection via Logical Reasoning on Graph Data

Andy Zhou, Xiaojun Xu, Ramesh Raghunathan, Alok Lal, Xinze Guan, Bin Yu, Bo Li

Abstract

Graph-based anomaly detection is a critical component in modern cybersecurity and fraud detection. However, standard Graph Neural Networks (GNNs) often struggle with distribution shifts and extreme class imbalance. This paper introduces KnowGraph, a framework that integrates specialized GNNs with a probabilistic reasoning component based on Markov Logic Networks (MLNs). By leveraging expert-defined logical rules, KnowGraph provides a robust "safety net" that maintains performance even when data distributions evolve or labels are scarce. Experimental results on massive real-world datasets from LANL and eBay demonstrate that KnowGraph significantly outperforms existing baselines in both inductive and transductive settings.

1. Introduction

In the realm of digital security, identifying malicious behavior—such as network intrusions or e-commerce collusion—often involves analyzing complex relationships between entities. Graph-based models, particularly Graph Neural Networks (GNNs), have become the standard for these tasks. Despite their success, GNNs are frequently "black-box" models that lack the ability to incorporate human domain knowledge and are notoriously sensitive to changes in data distribution.

KnowGraph addresses these limitations by bridging the gap between deep learning and symbolic logic. By combining the representational power of GNNs with the stability of first-order logic, the framework achieves state-of-the-art anomaly detection that is both scalable and interpretable.

2. Challenges in Graph Anomaly Detection

The authors identify two primary "brittleness" factors that plague traditional GNN-based systems:

2.1 Distribution Shifts

GNNs often fail to generalize to new data. For instance, a Graph Convolutional Network (GCN) trained on eBay transaction data was found to lose 50% of its accuracy when tested on data from just one day later. This sensitivity makes them unreliable for dynamic environments where attacker behavior and transaction patterns shift constantly.

2.2 Extreme Class Imbalance

In real-world security contexts, anomalies are "needles in a haystack." The datasets analyzed in this study exhibit extreme imbalance, with ratios of malicious to benign events as low as 1:3269. Standard models often struggle to learn the characteristics of the minority class under such conditions.

3. The KnowGraph Architecture

KnowGraph utilizes a two-pillar approach to ensure both predictive power and logical consistency.

3.1 The Learning Component

Rather than relying on a single monolithic model, KnowGraph employs a multi-task learning strategy. A Main Model handles the primary anomaly detection task, while several Knowledge Models are trained on semantic sub-tasks. In a network security context, these sub-tasks might include predicting authentication types (e.g., NTLM vs. Kerberos) or identifying specific node attributes. This multi-task synergy forces the system to develop a more nuanced understanding of the graph's underlying semantics.

3.2 The Reasoning Component

The core innovation of KnowGraph is its use of Markov Logic Networks (MLNs) for probabilistic inference. The outputs from the GNNs are treated as predicates in a set of expert-designed first-order logic formulas. For example, a rule might state: "If an authentication event uses a rare protocol and originates from a new account, it is likely malicious."

To ensure the system remains scalable to graphs with millions of nodes and billions of edges, the authors implement a Variational EM algorithm and a GCN-based reasoning model. This allows the complex probabilistic inference of MLNs to be performed efficiently.

3.3 Uncertainty Mitigation via PCS

To improve model reliability, the framework incorporates the Predictability-Computability-Stability (PCS) framework. By using weight noise ensembling—adding random perturbations to model weights during training and inference—KnowGraph can estimate prediction uncertainty. This leads to better "calibration," ensuring that the model's confidence scores accurately reflect the probability of a correct prediction.

4. Experimental Evaluation

The framework was evaluated on two large-scale datasets:

  • LANL (Los Alamos National Laboratory): A massive network dataset containing 1.6 billion authentication events, modeled as a graph with 45 million edges and only 518 malicious instances.
  • eBay Marketplace: A proprietary dataset of over 40 million transactions focused on detecting buyer-seller collusion.

4.1 Key Results

KnowGraph demonstrated superior performance across multiple metrics:

  • Generalization: In inductive settings (testing on unseen graphs), KnowGraph achieved an AUC of 0.9112 on the LANL dataset, outperforming the "Euler" baseline (0.8973).
  • Precision: On the eBay dataset, the combination of KnowGraph and the PCS framework (KnowGraph+PCS) achieved an Average Precision (AP) of 0.167, a massive improvement over the DGI baseline of 0.0001.
  • Calibration: The use of weight noise ensembling reduced the Expected Calibration Error (ECE) from 0.106 to 0.0755, providing more reliable outputs for human security analysts.

5. Discussion and Conclusion

KnowGraph demonstrates that human logic can act as a vital stabilizer for deep learning models. Because expert knowledge is more invariant than raw data distributions, the reasoning component can "correct" GNN predictions when the model encounters out-of-distribution data.

While the system currently relies on manually engineered rules, it automatically learns the weights for these rules, prioritizing the most effective ones. Future work may involve automating rule discovery and exploring more advanced architectures like Graph Transformers to further push the boundaries of hyper-scale graph anomaly detection.

Summary updated

BibTeX
@inproceedings{zhou2024knowgraph,
  author = {Andy Zhou and Xiaojun Xu and Ramesh Raghunathan and Alok Lal and Xinze Guan and Bin Yu and Bo Li},
  title = {{KnowGraph: Knowledge-Enabled Anomaly Detection via Logical Reasoning on Graph Data}},
  booktitle = {CCS},
  year = {2024},
}
Figure