Quantum machine learning for predictive maintenance: a hybrid quantum classifier against classical models on AI4I 2020
We tested a hybrid quantum neural network classifier, a 5-qubit circuit between linear layers on a noiseless simulator, on the public AI4I 2020 machine-failure data at its real failure rate, over five seeds. At this size the classical models are ahead: gradient boosting and a random forest score higher on every headline metric, and replacing the circuit with a classical block of the same size changes the score by less than the seed-to-seed noise. The run measures what a small circuit adds on this data, not what larger circuits or other sensor data could do; this page gives the numbers, why trees win here, and how to run the same test on your own sensor data with eigenkit.
Updated
The short answer
- Best model, test PR-AUC
- Gradient boosting, 0.782 ± 0.022
- Hybrid quantum classifier (HQNC)
- 0.587 ± 0.085, behind boosting, the random forest and both backbone networks
- Effect of the circuit
- HQNC minus its classical twin: 0.022 ± 0.044 PR-AUC per seed, = 0.32. The interval includes zero.
- Accuracy
- Misleading here: HQNC scores 0.970 ± 0.006, and a model that never predicts a failure is right on all but the 3.4% of rows that fail.
- Cost of the circuit
- Training HQNC took 23.3 s ± 1.2 s on the simulator, against 1.1 s ± 0.1 s for its classical twin.
The data and the question
AI4I 2020 is a synthetic dataset that models a milling process, published for predictive-maintenance research because real plant data is rarely public[2]. It has 10,000[1] rows, one per process run, with air and process temperature, rotational speed, torque, tool wear and the product quality type. The target, machine failure, is set when any of five failure modes occurs: tool wear, heat dissipation, power, overstrain or a random failure[1]. In our splits 3.4% of rows are failures.
We asked two questions. Does eigenkit's hybrid quantum neural network classifier, HQNC, predict failures better than classical models? And does its quantum circuit do better than a classical block of the same width and parameter count? The second question is the one that says whether the quantum part is doing anything; the method is explained on the quantum neural networks page.
The setup: a stratified 60/20/20 split into train, validation and test, a new split for each of five seeds, every split at the real failure rate. No model uses resampling or class weights. Each model gets a grid of three configurations, picked by validation PR-AUC, and a decision threshold picked on validation for failure-class F1. HQNC has a linear adapter from the 8 input features to 5 qubits, a 5-qubit circuit of depth 2 with eigenkit's strong ansatz, and a linear head. It runs on eigenkit's exact, noiseless statevector simulator. No QPU was used.
The headline metric is PR-AUC (average precision), because at a few percent positives it tracks what a maintenance team cares about: how many of the flagged runs really fail, across all thresholds. A random scorer gets a PR-AUC equal to the failure rate.
Results on the test split
Mean ± standard deviation over five seeds; each test split has 2,000 rows. Recall at precision is the share of failures caught while at least four in five alarms are real.
| Model | PR-AUC | ROC-AUC | Balanced accuracy | Macro F1 | Recall at precision ≥ 0.80 | Parameters (in the circuit) |
|---|---|---|---|---|---|---|
| Gradient boosting | 0.782 ± 0.022 | 0.971 ± 0.006 | 0.836 ± 0.022 | 0.855 ± 0.018 | 0.659 ± 0.084 | tree ensemble |
| Random forest | 0.755 ± 0.057 | 0.967 ± 0.013 | 0.809 ± 0.040 | 0.840 ± 0.041 | 0.585 ± 0.135 | tree ensemble |
| MLP backbone + circuit | 0.719 ± 0.049 | 0.959 ± 0.015 | 0.794 ± 0.048 | 0.812 ± 0.021 | 0.535 ± 0.080 | 2863 |
| MLP backbone + classical block | 0.700 ± 0.072 | 0.961 ± 0.016 | 0.790 ± 0.032 | 0.819 ± 0.025 | 0.515 ± 0.075 | 2863 |
| HQNC | 0.587 ± 0.085 | 0.949 ± 0.021 | 0.783 ± 0.045 | 0.778 ± 0.040 | 0.279 ± 0.059 | 87 |
| HQNC classical twin | 0.565 ± 0.058 | 0.938 ± 0.022 | 0.736 ± 0.052 | 0.750 ± 0.029 | 0.244 ± 0.086 | 87 |
| MLP of HQNC's size | 0.534 ± 0.087 | 0.924 ± 0.022 | 0.728 ± 0.026 | 0.753 ± 0.028 | 0.224 ± 0.145 | 90 |
| Logistic regression | 0.460 ± 0.062 | 0.896 ± 0.033 | 0.746 ± 0.019 | 0.735 ± 0.021 | 0.197 ± 0.093 | 9 |
Run hqnn-predictive-maintenance of 2026-11-03, mean and spread over 5 seeds, on AI4I 2020 Predictive Maintenance Dataset (Matzka 2020), target 'Machine failure'. The circuit holds 30 of HQNC's 87 parameters and 30 of the backbone model's 2863. The classical twins replace it with Linear(5, 5) and Tanh, which have the same width and the same number of parameters.
Does the circuit help? The ablation
Paired per seed: the quantum model minus its classical twin on the same split, with the two-sided paired t-test over five seeds. Positive means the circuit did better.
| Comparison | Mean difference ± std | p-value |
|---|---|---|
| HQNC vs its twin, PR-AUC | 0.022 ± 0.044 | 0.32 |
| HQNC vs its twin, balanced accuracy | 0.047 ± 0.077 | 0.24 |
| HQNC vs its twin, macro F1 | 0.029 ± 0.051 | 0.27 |
| HQNC vs its twin, ROC-AUC | 0.011 ± 0.017 | 0.21 |
| Backbone hybrid vs its twin, PR-AUC | 0.020 ± 0.049 | 0.42 |
| Backbone hybrid vs its twin, macro F1 | -0.007 ± 0.018 | 0.43 |
Run hqnn-predictive-maintenance of 2026-11-03, mean and spread over 5 seeds, on AI4I 2020 Predictive Maintenance Dataset (Matzka 2020), target 'Machine failure'. Every 95% confidence interval behind these rows includes zero. The small positive mean for HQNC could be a real effect of the circuit as a nonlinearity, or noise; five seeds, with a few dozen failures in each test split, cannot tell the two apart.
Why trees win here, and what the circuit does
AI4I failures are generated by threshold rules on the inputs: heat dissipation fails when the temperature difference is small and the speed low, power fails outside a band of torque times speed, overstrain when tool wear times torque passes a limit that depends on the product type[1]. Decision trees cut the feature space with exactly that kind of rule, so gradient boosting and random forests fit it with little tuning. A neural network has to approximate the products and thresholds from scaled raw inputs. Engineering the power and strain features by hand would help every network here, and the gap between model families (0.782 ± 0.022 for boosting against 0.534 ± 0.087 for an MLP of HQNC's size) is far larger than anything the circuit changes.
HQNC does beat that plain MLP and logistic regression. It is tempting to credit the circuit, and the ablation says not to: the classical twin, with Linear(5, 5) and Tanh where the circuit was, scores 0.565 ± 0.058, close to HQNC's 0.587 ± 0.085. What both share is the shape of the pipeline, a narrow bounded layer between two linear maps, and that shape is what helps. Behind a larger MLP backbone the circuit and its twin are tied. This matches the wider literature: in a large benchmark of quantum classifiers, classical models did better overall and removing entanglement often did not hurt[3].
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, and then gets close to a tuned tree ensemble. Here the first gap was inside the noise and the second was large. Three things could move that, and each can be tested rather than assumed.
Data that is not a set of threshold rules. AI4I's failure label is built from cuts on the inputs[1], which is the shape trees fit best, and the data has no time axis. Real sensor streams, with drift and a warning horizon, are a different task. The test is the same protocol on your own readings, split by time, with RecurrentHQNC next to boosting on the same windows.
A larger share for the circuit. Five qubits at depth 2 hold a small part of HQNC's parameters, and the small positive mean against the twin could be a real effect or noise. More seeds would tell the two apart, and a wider circuit gives the quantum layer more to do, at the cost of slower simulation and gradients that flatten with width; barren plateaus explains when that happens.
Real hardware. On a QPU, shot and gate noise lower the score from the simulator's best case, and every scored run is a circuit run. Before planning on a device, check which QPUs 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 its PR-AUC.In eigenkit: pip install "eigenkit[router]", then provider=RouterConfig(device=...) (docs).
How to run the same test on your own sensor data
Keep the real failure rate in validation and test
Balance the training set if you must, never the evaluation. Split by time if your rows are time-ordered, so the test period comes after the training period.
Start from strong classical baselines
Gradient boosting and a random forest on the raw and engineered features. They set the bar any other model has to clear.
Fit HQNC, or RecurrentHQNC for windows of sensor readings
HQNCtakes one row of features;RecurrentHQNCputs an LSTM or GRU in front of the circuit for sequences. Neither has a class-weight option, so handle imbalance in the data or the threshold.Score probabilities, not labels
Use PR-AUC and recall at a fixed precision from
predict_proba. eigenkit'scompare()scores predicted labels and ROC-AUC but has no PR-AUC, so compute it with scikit-learn, as below.Run the ablation over several seeds
Train the classical twin of the circuit with
GenericClassifieron the same splits and report the paired difference. The method is on the quantum neural networks page.Evaluate on hardware only if the simulator result holds
A trained model can be run on a QPU to measure what noise does to it. Training on the device is not the supported path.
HQNC against gradient boosting at a 3% failure rate
import warnings
from sklearn.datasets import make_classification
from sklearn.ensemble import HistGradientBoostingClassifier
from sklearn.metrics import average_precision_score
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
# 3% positives, like a failure label.
X, y = make_classification(n_samples=4000, n_features=10, n_informative=5,
weights=[0.97], random_state=0)
X_tr, X_te, y_tr, y_te = train_test_split(X, y, test_size=0.25, stratify=y, random_state=0)
scaler = StandardScaler().fit(X_tr)
X_tr, X_te = scaler.transform(X_tr), scaler.transform(X_te)
models = {
"HQNC": HQNC(in_features=10, n_qubits=5, depth=2, variational_type="strong",
n_classes=2, epochs=20, lr=0.01, show_progress=False),
"Gradient boosting": HistGradientBoostingClassifier(random_state=0),
}
print(f"random scorer: {y_te.mean():.3f}")
for name, model in models.items():
model.fit(X_tr, y_tr)
score = model.predict_proba(X_te)[:, 1]
print(f"{name}: PR-AUC {average_precision_score(y_te, score):.3f}")Synthetic data from scikit-learn, so it runs anywhere in about ten seconds. It prints the PR-AUC a random scorer would get and the PR-AUC of each model; on the run we checked, gradient boosting scored higher. One split is enough to wire the pipeline, not to rank models: repeat it over seeds, as the run above does.
Questions
Can quantum machine learning be used for predictive maintenance?
It can be used, in the sense that a hybrid quantum classifier trains and predicts failures on a simulator. On the public AI4I 2020 data it does worse than gradient boosting and a random forest, and its quantum circuit adds no measurable gain over a classical block of the same size. This run, a 5-qubit circuit on a simulator, gives no evidence that it helps on maintenance data; the page lists what would have to change for that to flip.
What is the best model for the AI4I 2020 predictive maintenance dataset?
In our five-seed run at the real failure rate, gradient boosting was best on PR-AUC, ROC-AUC, balanced accuracy, macro F1 and recall at 80% precision, with a random forest second. The failure label is built from threshold rules on the inputs, which tree ensembles capture easily.
Why not report accuracy for machine failure prediction?
Because failures are rare. On AI4I only a few percent of runs fail, so a model that always answers no failure is right on almost every row and catches nothing. PR-AUC, recall at a fixed precision and balanced accuracy show whether the failures are found.
Does the quantum layer in a hybrid model improve failure prediction?
Not measurably in our run. Replacing the 5-qubit circuit with a linear layer and tanh of the same width and parameter count gave a slightly lower mean PR-AUC, but the difference was within seed-to-seed noise and its confidence interval included zero.
Does the hybrid model run on real quantum hardware?
The run on this page used a noiseless simulator only. A trained eigenkit model can be evaluated on a QPU backend, where shot and gate noise would lower its score; training on the device is possible but slow and is not the supported workflow.
Sources
- S. Matzka. AI4I 2020 Predictive Maintenance Dataset. UCI Machine Learning Repository, dataset 601, 2020.
- S. Matzka. Explainable artificial intelligence for predictive maintenance applications. 2020 Third International Conference on Artificial Intelligence for Industries (AI4I), IEEE, pp. 69–74, 2020.
- 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