Source-linked AI summary
Impact of Data Loss in Postprocessing on Training and Inference of Quantum Neural Networks
Soraya V. Panambalom, Edoardo Altamura, Nick Chancellor, Jonte R. Hance
TL;DR
Simulator-oriented SamplerQNN postprocessing can discard valid hardware measurements when bit-strings span large physical-qubit registers, creating unnormalised probabilities without an API warning. The paper analyses this failure across inference and training experiments, identifies its layout-based cause, and reports a fix merged as Pull Request #1041.
Problem
SamplerQNN postprocessing assumes measurement bit-strings are in virtual qubit space, an assumption that fails for hardware outputs spanning large physical-qubit registers.
Method
The paper traces the failure through SamplerQNN postprocessing and evaluates its effects across hardware inference and training experiments using IBM backends.
Results
Accuracy drops from 0.94 to 0.39 for inference, while training loss is compressed by 22 to 27×; a layout-based marginalisation fix was merged as Pull Request #1041.
Takeaways & Limitations
The case study shows that evolving hardware interfaces require validation of library postprocessing assumptions alongside quantum hardware and model behaviour.
Takeaways & Limitations
Models trained on hardware cannot be corrected post hoc and require rerunning with the fix.
Abstract
from arXiv · showhide
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 \texttt{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$\times$, 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 \texttt{SamplerQNN} postprocessing forward-compatible with current and upcoming hardware.
I. INTRODUCTION
This paper examines data loss in SamplerQNN postprocessing when simulator-oriented assumptions meet quantum hardware outputs. The issue affects both inference and training, and can occur silently in released library versions and hardware-specific execution paths.
- Motivation and problem: SamplerQNN postprocessing assumes measurement bit-strings occupy virtual qubit space, although hardware outputs span physical qubit registers.The case study concerns sampling-based postprocessing in Qiskit Machine Learning and its interface with classical optimisation.
- Failure mode: 85 to 99.6% of valid measurement shots are discarded on real hardware because the filter assumes virtual-qubit bit-strings.The resulting probability vector does not sum to 1, but the model receives no API-level warning.
- Scope and remediation: The study motivates validation of classical software layers at the boundary between user code, libraries, transpilation, and evolving hardware.A layout-based marginalisation fix was submitted as Pull Request #1041 and merged into the official codebase.
- Scope and remediation: The behaviour appears in Qiskit Machine Learning 0.8.4 and 0.9.0 and manifests on real IBM hardware or SamplerV2, not default classical simulators.Simulators return measurements in virtual qubit space, so the filter condition is not triggered there.
- Impact: Inference accuracy drops from 0.94 to 0.39 on identical measurements, while training receives unnormalised probabilities through the loss function.The paper reports that the effect propagates differently depending on whether hardware is used for inference only or for training.
II. THE POSTPROCESSING DATA LOSS MECHANISM
The data-loss mechanism arises because transpilation maps virtual qubits onto potentially high-index physical qubits, while SamplerQNN filters full hardware bit-strings as though they represented only virtual qubits.
- Hardware representation: A transpiler maps n virtual qubits onto selected physical qubits, while the remaining device qubits act as irrelevant ancillas.The mapping depends on device connectivity and calibration conditions.
- Hardware representation: Hardware returns bit-strings covering all physical qubits, so postprocessing must extract virtual-qubit bits before evaluating the cost function.SamplerQNN measures all qubits in the transpiled circuit by default.
- Filter rule: The filter converts each measurement string to an integer and retains it only when the value is below 2^n, where n is the number of virtual qubits.For n = 4, the threshold is 16.
- Filter rule: The rule works only when virtual qubits occupy the lowest physical positions, because otherwise valid outcomes produce integers above the virtual-space threshold.The transpiler does not guarantee low physical positions.
B. Case 1: Data Loss from High Qubit Placement
High physical qubit placement causes the integer filter to reject nearly every valid outcome, because nonzero virtual bits appear at positions far above the virtual-space threshold.
- High qubit placement: A 4-qubit outcome mapped to positions [108, 109, 110, 118] becomes a 156-bit integer dominated by high physical-bit positions.The circuit outcome is valid in virtual-qubit space, but its full hardware representation is not small enough for the filter.
- High qubit placement: Except for |0000⟩, virtual outcomes at those positions exceed the filter threshold and are discarded.Even |0000⟩ survives only when all 152 ancilla bits are also zero.
- Observed consequence: 16 out of 4096 shots survive, corresponding to a 0.4% survival rate for this placement.The surviving shots therefore represent only a small fraction of valid measurements.
C. Case 2: Data Loss from Ancilla-Bit Contributions
Ancilla-bit contributions create a second failure mode: even low-position virtual qubits can yield large integers when irrelevant physical qubits flip, causing valid shots to be discarded and probabilities to become unnormalised.
- Ancilla-bit contributions: A single noisy ancilla bit at a high physical position can push an otherwise valid low-position measurement above the filter threshold.The active virtual-qubit result may be acceptable while the full hardware integer is rejected.
- Ancilla-bit contributions: Only 15.2% of shots survive for the 4-qubit model even at the lowest possible qubit positions.The remaining 85 to 96% carry valid virtual-qubit information but are discarded because of irrelevant-qubit noise.
- Unnormalised probabilities: The output probabilities sum to approximately 0.15 at 15.2% survival and approximately 0.004 at 0.4% survival, rather than 1.The denominator uses all 4096 shots while only surviving shots contribute to the numerator.
- Experimental evidence: Five hardware experiments used IBM Heron devices and four Sampler-based or variational classifier configurations trained on a noisy simulator before hardware inference.The experiments ran on ibm_kingston and ibm_torino, with 1024 shots per circuit evaluation.
- Experimental evidence: Experiments mapped to physical positions 0 to 6 gave correct results, whereas mappings in the 50s or above 100 produced near-random accuracy of 0.39.Because the circuit computation is unchanged by physical placement, the comparison indicates a position-dependent postprocessing error.
A. Impact on Inference
Inference results changed substantially when the same hardware measurements were postprocessed by retaining virtual-qubit bits rather than applying the SamplerQNN filter. The filter reproduced the original metrics while discarding nearly all shots, and correction altered model comparisons and scientific interpretation.
- Method C reproduced the original SamplerQNN results exactly across all five experiments and all 35 classification metrics.This tied the discrepancies to postprocessing rather than hardware execution or circuit design.
- 99.6% of valid shots were discarded by Method C in the most affected experiment, retaining only 16 of 4096 shots, whereas Method B used all shots.Both methods computed predictions from the same raw hardware measurements.
- Accuracy fell from 0.94 with all shots to 0.39 after the filter discarded 99.6% of valid shots.The comparison used the same raw measurements, with Method B retaining all shots and Method C applying the SamplerQNN filter.
- After correction, the SI+FE model achieved 0.94 accuracy on ibm_kingston, matching the standard Classifier Sampler.The corrected result showed that the apparent poor performance was associated with qubit placement rather than the architectural difference.
- After correction, the VQC with ZZFeatureMap had 0.54 hardware accuracy and F1 0.50, changing its interpretation from complete failure to moderate hardware degradation.Its simulator accuracy was 0.70, while the uncorrected hardware F1 was 0.31.
- Correction revealed that the performance gap was between the VQC architecture and Classifier Sampler, not between entanglement strategies.The uncorrected results obscured this comparison and could have led to different deployment assessments.
B. Impact on Training
On-device training was affected because SamplerQNN’s compressed, unnormalised probabilities distorted every loss evaluation and propagated into subsequent weight updates. The resulting near-constant loss signal could resemble a barren plateau, although the cause was postprocessing.
- Propagation: During hardware fine-tuning, postprocessing data loss affected both the five loss evaluations and the subsequent inference step.Simulator-trained weights were unaffected during inference-only experiments, where raw measurements could be reprocessed correctly.
- Loss distortion: The loss signal remained near-constant at approximately 0.01 to 0.02 despite the model’s actual performance.This produced very small gradients and made the signal resemble a barren plateau, but the stated cause was probability compression during postprocessing.
- Propagation: Uncorrected updates became irreversible from iteration 2 onward unless all sampled bit-strings were stored for later recovery.The paper notes that storing all bit-strings across many optimisation iterations is typically impractical because of storage overhead.
1) Loss Recomputation:
Raw measurement recomputation showed that the original filter gave COBYLA a persistently different loss landscape from the correctly marginalised measurements.
- Loss recomputation: The authors recomputed loss for all 10 optimisation jobs using three postprocessing methods.The jobs covered five iterations for each of two models.
- Loss recomputation: Method C stayed approximately between 0.01 and 0.02, while Method B produced the fiducial loss values.The large gap persisted across fine-tuning, so the optimiser navigated a landscape it could not see.
2) COBYLA and the Simplex Constraint:
COBYLA’s five available hardware iterations only constructed part of its initial simplex, so neither model reached an actual optimisation step. The hardware budget constrained completion of even that initial simplex.
- Simplex construction: COBYLA constructs an n+1-point simplex by evaluating the starting point and n single-weight perturbations.The perturbations shift one weight at a time by +1.0 rad.
- Simplex construction: The 4-qubit model required 13 evaluations and the 7-qubit model required 22 evaluations to complete their initial simplexes.These requirements follow from 12 and 21 trainable weights, respectively.
- Simplex construction: Zero actual optimisation steps were taken because five iterations built only 5 of 13 vertices for the 4-qubit model and 5 of 22 for the 7-qubit model.Every observed iteration belonged to simplex construction rather than optimisation.
- Hardware constraint: Completing the simplex alone required 104 minutes for four qubits or 176 minutes for seven qubits, against a 180-minute hardware allocation.Each iteration took approximately eight minutes, making the experiment structurally underdimensioned independently of the postprocessing issue.
3) Weight Drift Analysis:
Weight drift analysis confirmed simplex probing rather than optimisation and showed model-dependent consequences of accepting perturbations based on the distorted loss. The proposed layout-aware marginalisation uses physical qubit positions to recover valid virtual-space probabilities.
- 3) Weight Drift Analysis:: Every observed weight perturbation was exactly +1.0 radian along one parameter axis, consistent with simplex construction rather than optimisation.COBYLA’s keep-or-revert decisions should have used the distinct correctly marginalised losses, but instead used compressed values around 0.01 to 0.02.
- 3) Weight Drift Analysis:: Only 1 of 4 perturbations survived for the 4-qubit model, whereas all 4 survived for the 7-qubit model.The 7-qubit model’s correct loss rose monotonically from 0.41 to 0.44 as perturbations accumulated.
- IV. LAYOUT-BASED MARGINALISATION: Layout-aware marginalisation extracts bits at the physical positions of virtual qubits, reconstructs a virtual-space integer, and accumulates probabilities across ancilla states.This uses every shot and produces a probability distribution summing to 1.0.
- IV. LAYOUT-BASED MARGINALISATION: The fix replaces the integer-value filter with layout-based marginalisation while preserving the original behaviour when no layout is present.The change was reviewed and merged into the official codebase, with distribution planned for the next PyPI release.
- IV. LAYOUT-BASED MARGINALISATION: The issue was hidden by simulator outputs in virtual qubit space but became consequential on larger hardware registers and hardware-dependent qubit placements.Earlier devices with approximately 30 qubits or fewer were more likely to place virtual qubits below the filter threshold.
V. BROADER IMPLICATIONS
The paper assesses published workflows matching the SamplerQNN hardware-data-loss conditions and shows that software-level postprocessing errors can mimic hardware-related degradation. Affected inference results may be recoverable from saved raw counts, whereas affected training results cannot be corrected after the fact.
- Scope: Two published workflows were examined because they matched the conditions for SamplerQNN postprocessing data loss on real hardware.The search required SamplerQNN usage, affected Qiskit ML versions, and real-hardware or SamplerV2-like outputs.
- Related workflows: Martin-Perez et al. used SamplerQNN with four qubits, Qiskit ML 0.8.0, and SamplerV2 on the 133-qubit ibm_torino backend.
- Related workflows: Chaudhary et al. used SamplerQNN with four virtual qubits on the 156-qubit ibm_fez backend, satisfying the conditions for potential data loss.
- Implications: Software-level postprocessing errors can resemble hardware-noise effects, making raw bit-string normalisation necessary for distinguishing the causes.
- Implications: Saved raw counts can recover affected inference results, but training results cannot be corrected after the unnormalised loss signal has updated model weights.
VI. CONCLUSION
The study identifies and corrects a SamplerQNN postprocessing mechanism that discards most valid hardware measurement shots. The resulting effects span inference and training, while the merged layout-marginalisation fix provides a forward-compatible implementation.
- VI. CONCLUSION: 85 to 99.6% of valid measurement shots were discarded by SamplerQNN’s hardware-incompatible postprocessing mechanism.The root cause was a filter assuming bit-strings occupied virtual-qubit space, unlike hardware registers spanning over 100 physical qubits.
- VI. CONCLUSION: Inference accuracy fell from 0.94 to 0.39 on identical raw measurements, while training cost-function evaluation degraded by 22 to 27×.
- VI. CONCLUSION: The layout-marginalisation fix was merged as PR #1041 and is scheduled for PyPI availability from version 0.9.1.
- VI. CONCLUSION: Saved raw counts allow previous inference results to be corrected, but hardware-trained models require rerunning because their weights already incorporate the uncorrected loss signal.
- VI. CONCLUSION: The case study recommends validating assumptions across user code, libraries, transpilation, and hardware outputs when interpreting unexpected results.