Application

Quantum machine learning for fraud detection: a hybrid quantum classifier at the real fraud rate

We tested a hybrid quantum neural network classifier, a 5-qubit circuit between classical layers on a noiseless simulator, on the standard public card-fraud dataset at its real fraud rate of fewer than two transactions in a thousand. At this size the classical models are ahead: gradient boosting has the highest PR-AUC, logistic regression also scores higher, and replacing the circuit with a classical block of the same size does not lower the score. The run measures what a small circuit adds today, not what larger circuits or other data could do, and the same test runs on your own transactions.

Updated

The short answer

Best model, test PR-AUC
Gradient boosting, 0.825 ± 0.031
Logistic regression
0.779 ± 0.045 with 31 parameters
Hybrid quantum classifier (HQNC)
0.731 ± 0.068 with 197 parameters, 30 of them in the circuit
Effect of the circuit
HQNC minus its classical twin: -0.030 ± 0.041 PR-AUC per seed (pp = 0.17). The twin is not worse.
Accuracy
Meaningless: every model scores about 0.999, and answering legitimate every time is wrong only on the 0.17% that are fraud.
Grover search
Not used and not applicable: transaction scoring is classification, and eigenkit has no Grover search.

The data, at the real fraud rate

The dataset is the standard public benchmark for card fraud: 284,807[1] transactions by European cardholders over two days in September 2013, of which 492[1] are fraud[2]. For confidentiality the data owner released 28 principal components instead of the raw features, plus the time and the amount. All models see the same 30 standardised features.

The point of the setup is that validation and test keep the real fraud rate. Each of five seeds makes a new stratified 60/20/20 split of all rows, so each test split holds about 57,000 transactions with about 98 frauds, 0.17%. Only the training set is reduced, to save simulator time: it keeps every fraud and 10,000 legitimate transactions, 2.87% fraud. To check that this does not handicap the classical side, the same gradient-boosting grid was also trained on the full training split; it reached 0.828 ± 0.040 against 0.825 ± 0.031 on the reduced set.

No model uses class weights. Each gets three configurations, picked by validation PR-AUC, and a threshold picked on the full-rate validation split. HQNC maps the 30 features through a linear adapter onto 5 qubits, runs a depth-2 circuit with eigenkit's strong ansatz and ends in a linear head. Everything ran on eigenkit's exact, noiseless statevector simulator; no QPU was used.

Results on the test split

Mean ± standard deviation over five seeds. PR-AUC is average precision; a random scorer gets the fraud rate. Recall at precision ≥0.80\geq 0.80 is the share of frauds caught while at least four in five alerts are real.

ModelPR-AUCRecall at precision ≥ 0.80Macro F1ROC-AUCParameters
Gradient boosting0.825 ± 0.0310.837 ± 0.0320.914 ± 0.0160.984 ± 0.006tree ensemble
Random forest0.780 ± 0.0590.843 ± 0.0380.915 ± 0.0140.976 ± 0.012tree ensemble
Logistic regression0.779 ± 0.0450.794 ± 0.0690.902 ± 0.0200.983 ± 0.00831
MLP backbone + classical block0.792 ± 0.0510.814 ± 0.0660.904 ± 0.0190.972 ± 0.0154271
HQNC classical twin0.762 ± 0.0610.820 ± 0.0380.903 ± 0.0110.979 ± 0.013197
MLP of HQNC's size0.755 ± 0.0720.661 ± 0.3700.906 ± 0.0130.971 ± 0.013200
HQNC0.731 ± 0.0680.775 ± 0.0620.890 ± 0.0220.983 ± 0.005197
MLP backbone + circuit0.730 ± 0.0920.610 ± 0.3510.889 ± 0.0280.973 ± 0.0054271

Run hqnn-fraud-detection of 2026-11-03, mean and spread over 5 seeds, on creditcard (OpenML 1597): card transactions of European cardholders, September 2013 (Dal Pozzolo, Caelen, Johnson, Bontempi 2015), target 'Class'. ROC-AUC is near its ceiling for every model, which is why it cannot rank them at this fraud rate. Scoring one test split of about 57,000 transactions took 2.44 s ± 0.14 s for HQNC on the simulator and 0.15 s ± 0.03 s for gradient boosting.

Does the circuit help? The ablation

The classical twin is the same network with the circuit replaced by Linear(5, 5) and Tanh: the same width and the same number of parameters. Rows are per-seed differences, quantum minus classical, with the two-sided paired t-test over five seeds.

ComparisonMean difference ± stdp-value
HQNC vs its twin, PR-AUC-0.030 ± 0.0410.17
HQNC vs its twin, recall at precision ≥ 0.80-0.045 ± 0.0460.09
HQNC vs its twin, macro F1-0.012 ± 0.0140.12
HQNC vs its twin, ROC-AUC0.004 ± 0.0090.44
Backbone hybrid vs its twin, PR-AUC-0.062 ± 0.0850.18
Backbone hybrid vs its twin, macro F1-0.015 ± 0.0170.11

Run hqnn-fraud-detection of 2026-11-03, mean and spread over 5 seeds, on creditcard (OpenML 1597): card transactions of European cardholders, September 2013 (Dal Pozzolo, Caelen, Johnson, Bontempi 2015), target 'Class'. Negative means the classical block did better. The intervals include zero, so the run shows that the circuit does not help here; it does not show that it hurts.

Reading the result

Three things stand out. First, the order is classical first: boosting, the random forest, logistic regression and the classical twins all score a higher PR-AUC than HQNC. Second, the circuit is a small part of the hybrid model, 30 of 197 parameters in HQNC and 30 of 4271 in the backbone version, and swapping it for a classical block of the same size moves the score up rather than down. Third, the circuit is expensive to simulate: training HQNC took 28.2 s ± 2.3 s against 1.3 s ± 0.2 s for its twin.

Published work on quantum fraud detection is thin and mostly small-scale. One study applied a quantum support vector machine to card-payment data reduced to fit current hardware, compared it with rule-based decisions, random forests and XGBoost, and found that the results depended heavily on which features were selected; what it proposes is a mixed quantum-classical ensemble[3]. A simulation study of quantum kernels for unsupervised anomaly detection, with registers of up to 20 qubits[4], reported higher average precision than a classical one-class support vector machine; that comparison is between kernel methods for anomaly detection, run on a simulator, not against a tuned supervised model such as gradient boosting. Across small classical datasets in general, tuned classical models beat popular quantum classifiers overall[6].

Why Grover search does not speed up fraud detection

Grover's algorithm finds a marked item in an unstructured list with about the square root of the number of queries a classical search needs. Fraud detection is not that problem. A deployed model scores every transaction as it arrives, so there is no search over a stored list to shorten. Even where a search exists, Grover needs the data loaded into a quantum state and a circuit that marks the frauds, and that marking circuit would itself be a trained classifier.

There is also the hardware. A quadratic speed-up has to pay for the large overhead of error correction before it wins, and a careful estimate concluded that quadratic speed-ups will not give an advantage on early generations of fault-tolerant machines[5]. eigenkit has no Grover search algorithm; its Grover operator exists only inside amplitude estimation. The run on this page used no Grover step of any kind.

What would change this result

The signal to look for is a hybrid model that beats its classical twin, on the same splits and over several seeds, by more than the seed-to-seed spread. Here it did not. Three things could move that, and each can be tested rather than assumed.

A larger circuit. Five qubits and a depth-2 ansatz are a small part of the model: the classical layers around them hold most of its parameters. A wider circuit gives the quantum layer a larger share of the model and more room to differ from a classical block of the same width, but it is slower to simulate and harder to train, as gradients flatten with width; barren plateaus explains when that happens and what avoids it.

A different task. Supervised scoring against tuned gradient boosting is a demanding comparison. The simulation study above found quantum kernels ahead of a classical one-class SVM for unsupervised anomaly detection[4], a setting worth testing on your own unlabelled transactions with the same discipline: the same split, a tuned classical model next to it, several seeds.

Real hardware. On a QPU, gate noise and finite shots lower the score from the simulator's best case, and every scored transaction is a circuit run. Before planning on hardware, check which devices can run a circuit of this size within their error budget and what a run costs.

Run it on a real QPU with EigenOrbit RouterThe trained HQNC, scored on a sample of the test split on a real QPU, to measure what noise and finite shots cost it.In eigenkit: pip install "eigenkit[router]", then provider=RouterConfig(device=...) (docs).

Score a fraud model at the real rate

import warnings

from sklearn.datasets import make_classification
from sklearn.ensemble import HistGradientBoostingClassifier
from sklearn.metrics import average_precision_score, precision_recall_curve
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler

from eigenkit import HQNC

warnings.simplefilter("ignore", UserWarning)  # the HQNC input-adapter notice

# 1% positives in every split: the test set is never balanced.
X, y = make_classification(n_samples=8000, n_features=12, n_informative=6,
                           weights=[0.99], flip_y=0, random_state=0)

def recall_at_precision(y_true, score, floor=0.8):
    precision, recall, _ = precision_recall_curve(y_true, score)
    return recall[precision >= floor].max()

for seed in range(4):
    X_tr, X_te, y_tr, y_te = train_test_split(X, y, test_size=0.5, stratify=y, random_state=seed)
    scaler = StandardScaler().fit(X_tr)
    X_tr, X_te = scaler.transform(X_tr), scaler.transform(X_te)
    models = {
        "HQNC": HQNC(in_features=12, n_qubits=5, depth=2, variational_type="strong",
                     n_classes=2, epochs=20, lr=0.01, show_progress=False),
        "Boosting": HistGradientBoostingClassifier(random_state=0),
    }
    for name, model in models.items():
        score = model.fit(X_tr, y_tr).predict_proba(X_te)[:, 1]
        print(f"split {seed} {name}: PR-AUC {average_precision_score(y_te, score):.3f}, "
              f"recall at P>=0.8 {recall_at_precision(y_te, score):.3f}")

Synthetic data from scikit-learn, under a minute on a laptop CPU. It prints PR-AUC and recall at 80% precision for each model on four splits of the same data. On the run we checked, the leading model changed from one split to the next, and HQNC's recall at 80% precision moved several-fold between splits: with 40 frauds in a test split, one split cannot rank two models. That is why the run above uses the real data, five seeds and paired differences.

Questions

Can quantum machine learning detect credit card fraud?

A hybrid quantum classifier can be trained to flag fraud on a simulator, but on the standard public card-fraud dataset at its real fraud rate it does worse than gradient boosting, a random forest and logistic regression. Replacing its quantum circuit with a classical block of the same size does not lower the score. There is no evidence yet that the quantum part helps.

Is quantum machine learning better for imbalanced data?

Nothing in our run suggests it. With validation and test at the real rate of fewer than two frauds in a thousand transactions and no class weights for any model, the quantum classifier ranked below the classical models, and the classical twin of its circuit scored slightly higher. Imbalance is handled the same way for both kinds of model: by the evaluation metric, the threshold and the training sample.

Does Grover's algorithm speed up fraud detection?

No. Grover's algorithm speeds up unstructured search, while fraud detection scores each transaction as it arrives, which is classification. A Grover search would also need the data loaded into a quantum state and a marking circuit that is itself a fraud classifier, and quadratic speed-ups are not expected to pay off on early error-corrected hardware.

Which metric should I use to evaluate a fraud model?

Use PR-AUC (average precision) and recall at a fixed precision, measured on data at the real fraud rate. Accuracy is close to 1 for every model, including one that never flags anything, and ROC-AUC is near its ceiling for most models, so neither separates them.

Can I run a quantum fraud model on real quantum hardware?

A small trained model can be evaluated on a QPU, but shot and gate noise would lower its score, and scoring tens of thousands of transactions one circuit at a time is slow and costly. Our run used a noiseless simulator only.

Sources

  1. A. Dal Pozzolo, O. Caelen, G. Bontempi. creditcard (credit card fraud detection). OpenML, dataset 1597, 2015.
  2. A. Dal Pozzolo, O. Caelen, R. A. Johnson, G. Bontempi. Calibrating probability with undersampling for unbalanced classification. 2015 IEEE Symposium Series on Computational Intelligence, pp. 159–166, 2015.
  3. M. Grossi, N. Ibrahim, V. Radescu, R. Loredo, K. Voigt, C. von Altrock, A. Rudnik. Mixed quantum-classical method for fraud detection with quantum feature selection. IEEE Transactions on Quantum Engineering, 2022. arXiv:2208.07963.
  4. O. Kyriienko, E. B. Magnusson. Unsupervised quantum machine learning for fraud detection. arXiv preprint, 2022. arXiv:2208.01203.
  5. R. Babbush, J. R. McClean, M. Newman, C. Gidney, S. Boixo, H. Neven. Focus beyond quadratic speedups for error-corrected quantum advantage. PRX Quantum 2, 010103, 2021. arXiv:2011.04149.
  6. J. Bowles, S. Ahmed, M. Schuld. Better than classical? The subtle art of benchmarking quantum machine learning models. arXiv preprint, 2024. arXiv:2403.07059.

Run it yourself with eigenkit

eigenkit is EigenOrbit's open-source Python library: write a circuit once, run it on any simulator or QPU, and test it against a classical baseline on your own data before you invest in it or rule it out.

$ pip install eigenkit