arXiv:2609.05060quant-phSep 2026

Manuscript Offprint

arXiv:2609.05060

Impact of Data Loss in Postprocessing on Training and Inference of Quantum Neural Networks

Soraya V. Panambalom, Edoardo Altamura, Nick Chancellor, Jonte R. Hance

Soraya V Panambalom¹,*ᵉ, Edoardo Altamura²,³ᵉ, Nick Chancellor¹ᵉ, and Jonte R Hance¹,†ᵉ

Abstract—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.

Index Terms—Quantum computing, Neural networks, Software reliability, Data postprocessing, Machine learning

I. INTRODUCTION

Reliable software behaviour is key for reproducible scientific workflows, particularly when deploying algorithms to specialised hardware. When software assumptions fail silently, the resulting effects can be difficult to distinguish from physical noise, and can propagate into the final results and their interpretation [1]. Reproducibility studies have shown that scientific code can be difficult to execute and validate across computational environments [2]; and a study of Harvard replication datasets found that approximately half of the code provided successfully executed [3], even after automatic code-cleaning corrected simpler errors (e.g., use of absolute rather than relative paths). This has obvious impacts for reproducibility of data based on this code.

In a quantum setting, it is crucial that the classical software layers that interface with the machines and perform supporting computations are correct. This is especially important in hybrid

quantum-classical settings, where the classical components are integral pieces of the computational model [4]. Most current quantum machine learning algorithms fall into this category as they are often variational, with training loops based on sampling distributions [5] to compute the objective value from raw counts or observables. Even outside of a hybrid setting, some classical processing is needed (e.g., collection and processing of sample data, and deciding QPU inputs). In this manuscript, we present a case study of data loss in a sampling-based postprocessing routine within the Qiskit Machine Learning (ML) library [6], arising when code paths originally consistent with simulator-style outputs were used with utility-scale hardware outputs. This case study highlights how classical software must evolve alongside the platforms it supports, and illustrates the impact that such issues can have on reported data.

The behaviour is traced to SamplerQNN, a Sampler-derived primitive implemented in Qiskit ML that interfaces parameterised quantum circuits to classical optimisers. It executes quantum circuits via a Sampler backend, collects the measurement outcomes, and postprocesses them into a probability vector that can be used for classification, regression, or other downstream tasks. The postprocessing logic was designed for simulators, which return measurement bit-strings over the virtual qubits only. However, current IBM quantum hardware behaves differently: the Qiskit transpiler maps nn virtual qubits onto NN physical qubits (where N>100N > 100 for Eagle and Heron devices), and the backend returns bit-strings over all NN measured qubits. This discrepancy between the expected and actual measurement formats causes the postprocessing step to produce biased results in hardware runs.

The postprocessing filter in SamplerQNN._postprocess discards bit-strings whose decimal integer value exceeds 2n2^n. On real hardware, this eliminates 85 to 99.6% of valid shots depending on the transpiler's qubit placement, producing a probability vector that does not sum to 1. Thus, the ML model receives an incorrect signal, but without warning the user.

This behaviour manifests itself in both training and inference. When the optimiser runs on hardware, the unnormalised probabilities propagate into the loss function at every iteration, and the resulting weight updates cannot be corrected after the fact. When the model is trained classically via a simulator and only inference is performed on hardware, the predictions are incorrect, but the trained weights are intact and the correct results can be recovered by reprocessing the raw measurements.

We identified this issue while running quantum machine

¹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 *sorayapanambalom@gmail.com †jonte.hance@newcastle.ac.uk learning experiments on IBM quantum hardware, traced it to the source code, and submitted a fix covering layout-based marginalisation. The issue was reported on the Qiskit ML GitHub repository (#1040 [7]), and our fix was submitted as Pull Request (PR) #1041 [8]. The PR was reviewed by the library maintainers and merged into the official codebase on 7 May 2026. The fix will be included in the upcoming version release (installable from PyPI via pip); in the meantime, users can access the updated SamplerQNN by manually installing Qiskit ML from source 1^{1}.

We verified this behaviour in recent versions of the library, including 0.8.4 and 0.9.0. However, it was not triggered when using classical simulators because the default Sampler returns measurements in virtual qubit space, where the filter condition is never met. It only manifests when using real IBM quantum hardware or SamplerV2, with all qubits measured by default.

This paper is organised as follows. Section II describes the issue in detail: how the postprocessing filter works, and the two distinct failure modes we identified: one driven by qubit placement, the other by ancilla noise. Section III presents the experimental evidence across five experiments on two real IBM quantum devices, showing that the issue affects both inference results (accuracy dropping from 0.94 to 0.39 on identical measurements) and the training loop (loss signal compressed by 22 to 27×27\times). Section IV describes our fix and explains why the issue was not triggered earlier. Finally, Sections V and VI discuss the implications for Qiskit ML users, concluding with an outlook on forward-compatibility of open source software for quantum machine learning applications.