Abstract
Detecting rare, subtle anomalies within high-dimensional data remains a fundamental challenge in machine learning, particularly when anomalies are "in-distribution" and share the same manifold as normal data. We present SPARKER, an anomaly detection framework utilizing a sparse, self-organizing ensemble of competing local kernels. By framing anomaly detection as a Neyman-Pearson two-sample test, SPARKER estimates the likelihood ratio between an inspected dataset and a reference nominal set. Our method demonstrates state-of-the-art performance across diverse domains—including particle physics, biology, and natural language processing—while providing intrinsic geometric interpretability.
Introduction: The Challenge of Subtle Anomalies
Standard Anomaly Detection (AD) techniques are typically optimized for "out-of-distribution" (OOD) scenarios where anomalous samples are clearly distinct from the training distribution. However, these methods often fail in regimes characterized by low anomaly fractions and low separability, where anomalies are embedded within the normal data manifold. Such "in-distribution" anomalies are common in scientific discovery—such as identifying rare physical phenomena or biological variants—and in validating generative AI, where subtle hallucinations may be statistically significant but visually or textually similar to valid data.
The primary difficulty lies in the poorly controlled statistical properties of modern neural network embeddings, which can cause subtle signals to be obscured by noise. SPARKER addresses this by operating with minimal prior information, focusing on identifying regions of statistical over-density or under-density relative to a reference dataset.
The SPARKER Framework
SPARKER is designed around three core inductive biases that distinguish it from global neural architectures:
- Locality: Instead of global activation functions like ReLU, SPARKER employs Gaussian kernels that only respond to data within a specific geometric neighborhood.
- Competition: A SoftMax-like mechanism forces kernels to compete to represent different regions of the data space, preventing them from collapsing onto the same statistical fluctuations.
- Sparsity: By utilizing a minimal number of kernels (e.g., $M=5$), the model is forced to find the most parsimonious explanation for the observed data deviations.
The training process treats anomaly detection as a Neyman-Pearson (NP) two-sample test. The model compares an unlabeled "inspected" dataset against a nominal reference set to estimate the log-likelihood ratio. A custom NP loss function is used to avoid the vanishing gradient issues common in standard binary cross-entropy when dealing with rare events.
Learning Dynamics and Interpretability
The learning process in SPARKER can be viewed as a physical system of interacting particles. Reference data points act as "repulsive" forces, while inspected data points act as "attractive" forces. Kernels naturally drift toward regions where the inspected data density exceeds the reference density. To ensure global exploration and avoid local minima, we employ deterministic scale annealing: kernels begin with a large width ($\sigma$) to survey the entire feature space and gradually shrink to localize specific anomalous regions.
As shown in Figure 6, radial (local) activations are significantly more effective at pinpointing localized "signal injections" compared to linear activations, which tend to produce broad, less precise regions of interest. Furthermore, the application of $L_1$ regularization (sparsity) ensures that the model does not overfit to minor statistical noise in the reference data.
Experimental Evaluation
We evaluated SPARKER across a wide array of complex datasets:
- Physics: Detection of gravitational waves in LIGO data and identifying Higgs boson signatures in particle jet clusters.
- Biology: Identifying rare hybrid species in the Heliconius butterfly collection.
- NLP: Distinguishing authentic text (Dante’s Divine Comedy) from subtle AI-generated hallucinations (Meta-Llama-3).
- Computer Vision: Detecting "striped" texture anomalies in ImageNet and validating diffusion model outputs (CIFAR-5m).
Key Results and Discussion
SPARKER consistently matched or outperformed established baselines such as Falkon and Nyström-MMD. Notably, it maintained high sensitivity even at anomaly fractions as low as 1%. In the ImageNet OOD task, SPARKER reduced the False Positive Rate (FPR) from 66% (standard logit-based methods) to a mere 2.5% at a 95% True Positive Rate.
Beyond performance, SPARKER offers unique intrinsic interpretability. Because each kernel is local and sparse, researchers can directly inspect the samples that trigger specific components. In the NLP task, individual kernels isolated specific linguistic patterns unique to the LLM. In particle physics, the model autonomously identified a cluster corresponding to the 125 GeV mass of the Higgs boson, demonstrating its utility for "blind" scientific discovery.
Conclusion
SPARKER demonstrates that local, competitive, and sparse architectures are highly effective for detecting rare statistical anomalies. While the current implementation relies on pre-existing feature extractors, future work will explore adaptive kernel geometries and the integration of trainable embeddings to further enhance detection power in even more complex data manifolds.
Summary updated