Weakly Supervised Anomaly Detection via Knowledge-Data Alignment

Haihong Zhao, Chenyi Zi, Yang Liu, Chen Zhang, Yan Zhou, Jia Li

Abstract

Weakly Supervised Anomaly Detection (WSAD) leverages a small set of labeled anomalies to improve detection accuracy over unsupervised methods. However, WSAD often suffers from poor generalization to unseen anomaly types. This paper discusses KDAlign (Knowledge-Data Alignment), a framework that integrates symbolic human-expert knowledge with numeric data features. By utilizing Optimal Transport (OT) to align rule embeddings with data representations, KDAlign enhances model robustness and performance, particularly in scenarios with extreme label scarcity.

1. Introduction

Anomaly detection (AD) is a critical task across various domains, including financial fraud detection, medical diagnosis, and industrial monitoring. While unsupervised methods are widely used, they frequently suffer from high false-positive rates due to the lack of prior knowledge about what constitutes an anomaly. Weakly Supervised Anomaly Detection (WSAD) addresses this by incorporating a limited number of labeled anomalies. Despite its advantages, WSAD models often fail to generalize beyond the specific types of anomalies present in the training set.

Human experts often possess domain-specific "rules-of-thumb" that can identify potential anomalies (e.g., flagging transactions over a certain threshold from unrecognized IPs). However, bridging the gap between these symbolic, discrete rules and the continuous numerical space of deep learning models remains a significant challenge. This paper presents KDAlign, a novel framework designed to inject expert knowledge into neural networks through a distribution-alignment approach.

2. The KDAlign Framework

The KDAlign framework operates through a three-stage process designed to harmonize symbolic knowledge with raw data features.

2.1 Knowledge Representation

To integrate expert knowledge, symbolic rules (e.g., if-then statements) are first converted into propositional logic. These logical expressions are then transformed into Deterministic Decomposable Negation Normal Form (d-DNNF) graphs. A Graph Convolutional Network (GCN) is employed to encode these structural representations into high-dimensional embeddings, effectively mapping discrete logic into a continuous vector space.

2.2 Data Representation

Simultaneously, raw data points are processed through a standard deep learning encoder, such as a Multi-Layer Perceptron (MLP) or a Residual Network (ResNet). This produces data embeddings that reside in the same dimensional space as the rule embeddings, facilitating direct comparison and alignment.

2.3 Knowledge-Data Alignment via Optimal Transport

The core innovation of KDAlign is the use of Optimal Transport (OT) to align the distribution of rules with the distribution of data. Rather than enforcing a rigid one-to-one mapping, the framework utilizes the Sinkhorn-Knopp algorithm to find an optimal transport plan. This plan determines the most efficient way to match rule embeddings to data embeddings. By minimizing the OT distance as part of the loss function, the model learns to push data points that satisfy expert rules toward the "anomaly" region of the feature space, even in the absence of explicit labels for those points.

3. Experimental Evaluation

The authors evaluated KDAlign across five diverse real-world datasets:

  • Amazon & YelpChi: Focused on detecting fake or spam reviews.
  • Cardiotocography: Identifying fetal health anomalies in medical data.
  • Satellite: Detecting anomalies in satellite imagery.
  • SpamBase: Classifying email spam.

To simulate expert knowledge in the absence of proprietary industrial rules, the researchers trained decision trees on auxiliary data and extracted decision paths to serve as the rule set.

4. Key Results and Insights

KDAlign demonstrated significant performance gains when integrated into existing state-of-the-art (SOTA) architectures such as DevNet, PReNet, and FeaWAD.

  • Superior Performance: KDAlign-enhanced models consistently outperformed baselines. Notably, KDAlign-PReNet achieved a 104.53% improvement in Area Under the Precision-Recall Curve (AUPRC) on the Satellite dataset compared to the standard PReNet.
  • Robustness to Data Scarcity: The framework proved highly effective in "few-shot" scenarios. Even with as few as 1, 3, or 5 labeled anomalies, KDAlign maintained high performance where traditional WSAD methods often failed to converge.
  • Noise Resilience: The system exhibited remarkable robustness to imperfect knowledge. When 20% of the provided rules were intentionally made noisy or incorrect, KDAlign still outperformed models that utilized no expert rules at all, demonstrating the stability of the global OT alignment.

5. Conclusion and Future Work

KDAlign provides a robust mechanism for bridging the gap between symbolic expert knowledge and deep learning for anomaly detection. By treating rules as "virtual labels" and aligning them via Optimal Transport, the framework significantly improves generalization and performance under label scarcity.

Future research directions include extending KDAlign to graph-based data domains, exploring faster Optimal Transport variants for improved scalability, and enhancing the explainability of the alignment process to provide experts with feedback on how their rules influence model decisions.

Summary updated

BibTeX
@inproceedings{zhao2024weakly,
  author = {Haihong Zhao and Chenyi Zi and Yang Liu and Chen Zhang and Yan Zhou and Jia Li},
  title = {{Weakly Supervised Anomaly Detection via Knowledge-Data Alignment}},
  booktitle = {The Web Conference},
  year = {2024},
}
Figure