Impact of Data Loss in Postprocessing on Training and Inference of Quantum Neural Networks
Authors: Soraya V. Panambalom, Edoardo Altamura, Nick Chancellor, Jonte R. Hance
Organizations: Quantum Group, School of Computing, Newcastle University, 1 Science Square, Newcastle upon Tyne, NE4 5TG, UK · National Quantum Computing Centre, Didcot, OX11 0QX, UK · Yusuf Hamied Department of Chemistry, University of Cambridge, Lensfield Road, Cambridge CB2 1EW, UK
As quantum hardware scales to larger devices, the classical software layers that interface with it must evolve in step. Postprocessing routines developed and tested primarily in simulator settings can encode assumptions that no longer hold on utility-scale devices, leading to data loss that can be difficult to detect from high-level model outputs alone. We present a case study of SamplerQNN, the sampling-based quantum neural network class in the Qiskit Machine Learning library. Here, the postprocessing method applies a filter that assumes measurement bit-strings are in virtual qubit space. On our quantum hardware runs, where bit-strings span over 100 physical qubits, this filter led to the loss of 85 to 99.6% of valid measurement shots, depending on the transpiler's qubit placement. The resulting probability vector is unnormalised, allowing distorted prediction and loss values to propagate through the model without an API-level warning. We demonstrate the impact across five experiments on two IBM backends: for inference, accuracy drops from 0.94 to 0.39 on the same raw measurements; for training, the loss signal is compressed by 22 to 27×, substantially reducing the sensitivity of the optimiser to the objective landscape. The behaviour arises in all released versions of the library (0.8.4 to 0.9.0). We implemented a layout-based marginalisation fix, merged into the GitHub codebase as Pull Request #1041, that makes SamplerQNN postprocessing forward-compatible with current and upcoming hardware.
Figures & tables
Model
Q
Backend
Positions
Surv.
CS
4
ibm_kingston
[0,1,2,3]
15.2%
CS
7
ibm_torino
[0,1,2,3,4,5,6]
4.1%
CS (SI+FE)
4
ibm_kingston
[108,109,110,118]
0.4%
VQC (ZZ)
4
ibm_torino
[61,62,54,60]
0.2%
VQC (Z)
7
ibm_torino
[0,1,2,3,4,5,6]
5.2%
TABLE I: Physical qubit positions assigned by the transpiler and percentage of measurement shots surviving the SamplerQNN filter for each experiment.
Model
Qubits
Method A
Method B
Method C
CS
4
0.57
0.94
0.94
CS
7
0.63
0.92
0.89
CS (SI+FE)
4
0.56
0.94
0.39
VQC (ZZ)
4
0.44
0.54
0.39
VQC (Z)
7
0.45
0.59
0.61
TABLE II: Accuracy comparison of three postprocessing methods on the same raw hardware measurements. CS: Classifier Sampler. SI+FE: Small-Angle Initialisation with Full Entanglement. Methods A, B, and C are defined in Section III-A .
Model
Qubits
Method A
Method B
Method C
CS
4
0.56
0.93
0.93
CS
7
0.60
0.91
0.88
CS (SI+FE)
4
0.56
0.93
0.37
VQC (ZZ)
4
0.43
0.50
0.31
VQC (Z)
7
0.45
0.53
0.57
TABLE III: F1 score (macro) comparison of three postprocessing methods on the same raw hardware measurements. CS: Classifier Sampler. SI+FE: Small-Angle Initialisation with Full Entanglement. Methods A, B, and C are defined in Section III-A .
Met. C (filter)
Met. B (marginal.)
Class
Prec.
Rec.
F1
Prec.
Rec.
F1
Malignant
0.34
0.74
0.47
0.95
0.88
0.91
Benign
0.54
0.18
0.27
0.93
0.97
0.95
Accuracy
0.39
0.94
TABLE IV: Per-class classification metrics computed from the same raw hardware measurements. Method C retains only 16 of 4096 shots (0.4%); Method B uses all 4096.
Model
Iter.
A
B
C
Surv.
4Q
1 (clean)
0.50
0.33
0.012
3.7%
2 (affected)
0.50
0.42
0.016
3.7%
3 (affected)
0.50
0.33
0.012
3.7%
4 (affected)
0.50
0.41
0.016
4.0%
5 (affected)
0.50
0.34
0.014
4.0%
7Q
1 (clean)
0.50
0.41
0.019
4.6%
TABLE V: Loss recomputed from raw measurements at each hardware iteration. Method C is what the optimiser received; Method B is the correct loss. Iteration 1 uses clean simulator-trained weights; iterations 2 to 5 use weights affected by prior uncorrected updates.
Fig. 1: Loss for 5 on-device fine-tuning iterations, recomputed from raw measurements. Method B (correct marginalisation) reveals the actual loss landscape; Method C (original filter) shows what COBYLA received. The star marks iteration 1 (clean simulator-trained weights); the shaded region marks iterations where the weights had already been affected by prior uncorrected updates.
Model
Iter.
Δw0
Δw1
Δw2
Δw3
# changed
Loss C
4Q (12 weights)
1 (clean)
0
0
0
0
0
0.012
2
+1.0
0
0
0
1
0.016
3
0
+1.0
0
0
1
0.012
4
0
+1.0
+1.0
0
2
0.016
5
0
+1.0
0
+1.0
2
0.014
inference
0
+1.0
0
0
1
−
TABLE VI: Weight drift relative to clean simulator-trained values at each iteration. All non-zero changes are exactly ± 1.0 rad (= rhobeg ), confirming simplex probing. Loss C is the value the optimiser received and used to decide whether to keep or revert each perturbation.
College of Information and Communication Technology, Can Tho University, Can Tho, Vietnam · College of Engineering and Computer Science, VinUniversity, Hanoi, Vietnam · Center for Digital Transformation and Communications, Can Tho University, Can Tho, Vietnam +1
Intrinsic Lab, Centre for Sensors, Instrumentation and Cyber-Physical System Engineering (SeNSE), Indian Institute of Technology Delhi, New Delhi 110016, India