Towards Efficient Quantum Anomaly Detection: One-Class SVMs Using Variable Subsampling and Randomized Measurements

Michael Kölle, Afrae Ahouzi, Pascal Debus, Robert Müller, Daniëlle Schuman, Claudia Linnhoff-Popien

TL;DR

Quantum Machine Learning (QML) shows immense promise for anomaly detection via complex quantum kernels, but conventional methods suffer from a prohibitive quadratic time complexity relative to data size. This paper introduces two linear-time approaches—randomized measurements and a variable subsampling ensemble—to drastically accelerate One-Class Support Vector Machines (OC-SVMs). The methods achieve up to a 95% reduction in training time, offering a vital step toward making quantum anomaly detection practical for real-world datasets.

What Problem Does This Paper Address?

Anomaly detection is the digital shield used to spot everything from credit card fraud to failing industrial machinery. One-Class Support Vector Machines (OC-SVMs) are a standard unsupervised tool for this task, mapping data into a higher-dimensional feature space to draw a boundary around "normal" behavior, as illustrated in Figure 1.

Mapping to feature space

By using quantum kernels (like the IQP-like feature map), QML can capture complex data patterns that are classically impossible to simulate, theoretically boosting anomaly detection precision.

The Catch: Calculating these quantum kernels traditionally scales quadratically ($O(N^2)$) with the number of data points $N$. Because quantum computing is inherently probabilistic, every single kernel evaluation requires thousands of "shots" (circuit repetitions). For a standard dataset like the Credit Card Fraud benchmark (284,000 instances), standard quantum kernel estimation would take an estimated 255 years to train! This massive time complexity completely blocks quantum OC-SVMs from real-world or real-time deployment.

Methods

The authors explore two distinct strategies to break the quadratic bottleneck and achieve linear time complexity:

  1. Randomized Measurements Kernel: Instead of running deep, expensive quantum state overlap tests (like the inversion or swap tests shown in Figure 2) for every pair of data points, this method applies random local Haar unitaries to the quantum states before measuring them. By classically post-processing these randomized measurement probabilities, they can approximate the quantum kernel. This shifts the heavy lifting from quantum hardware to classical computers, achieving a linear quantum time complexity.
  2. Variable Subsampling Ensemble: This is a clever classical ensemble technique adapted for the quantum realm. Instead of training one massive quantum OC-SVM, the algorithm trains an ensemble of smaller base models (using the standard quantum inversion test) on randomly selected subsets of varying sizes (e.g., between 50 and 1000 points). This bounds the kernel matrix sizes, ensuring the overall training time scales linearly with the total dataset size.
Quantum circuits for kernel evaluation

Datasets

The methods were evaluated using two datasets across 15 distinct random seeds:

  • Synthetic Data: A two-dimensional, non-linearly separable dataset used to benchmark performance and timing across various training sizes ($n \in \{250, 500, \dots, 1500\}$) with a 30% anomaly ratio.
  • Credit Card Fraud Dataset: A real-world dataset containing ~284,000 anonymous, PCA-engineered transactions. For the scaling experiments, the dimensionality was fixed to 6 features, maintaining a highly imbalanced 5% anomaly ratio in the test set.

Key Insights and Ideas

  • The Classical Post-Processing Trap: While randomized measurements successfully reduce quantum hardware time to linear complexity, the classical post-processing step scales quadratically with data size and exponentially with the number of qubits (features). For high-dimensional data ($\ge 8$ qubits), this classical bottleneck causes training times to skyrocket, highlighting a major hurdle for near-term quantum advantage.
  • Divergence from Prior Claims: The authors attempted to replicate prior literature which claimed a massive 20% precision boost using quantum kernels. However, using rigorous random data splits over 15 seeds, they found that the quantum advantage was marginal and highly dependent on specific, lucky sample selection rather than an inherent quantum superiority.
  • Stability vs. Performance Trade-off: The unmitigated randomized measurement kernel achieved high average precision but suffered from high variance (instability). Conversely, the variable subsampling method proved highly stable and predictable but suffered from lower precision due to conservative hyperparameter choices.

Key Results

  • Massive Speedups: The variable subsampling ensemble achieved a staggering ~95% reduction in training time and a ~25% reduction in inference (testing) time for 1,500 data points compared to the standard quantum inversion test.
  • Randomized Measurement Efficiency: On the Credit Card dataset, randomized measurements realized up to a 50% reduction in training time while maintaining a 35% reduction in testing time compared to the inversion test.
  • Detection Performance: On the synthetic dataset, quantum methods outperformed the classical Radial Basis Function (RBF) kernel in average precision. However, when using standard thresholding, classical RBF models still yielded superior F1-scores (~0.88) with much lower variance.

Limitations and Future Work

The exponential classical post-processing cost of randomized measurements severely limits its use to low-dimensional feature spaces. Additionally, the variable subsampling approach underachieved in F1-score due to conservative hyperparameter choices ($\nu$ and ensemble component counts).

To overcome these limits, the authors suggest several promising future directions:

  • Integrating variable subsampling directly with randomized measurement kernels.
  • Exploring Classical Shadows, which offer lower average error compared to standard randomized measurements.
  • Implementing Nyström or block basis factorization approximations to scale quantum kernels effectively without the full quadratic overhead.

Summary updated

BibTeX
@inproceedings{kolle2024towards,
  author = {Michael Kölle and Afrae Ahouzi and Pascal Debus and Robert Müller and Daniëlle Schuman and Claudia Linnhoff-Popien},
  title = {{Towards Efficient Quantum Anomaly Detection: One-Class SVMs Using Variable Subsampling and Randomized Measurements}},
  booktitle = {ICAART},
  year = {2024},
  doi = {10.5220/0012381200003636},
}
Figure