Shot Budgets for Quantum Prototype Classifiers on Imbalanced, Site-Shifted Medical Images

A quantum computer can compare two vectors without reading them out. Each vector is loaded as a quantum state, and a short interference circuit called the swap test returns a random bit whose bias encodes their squared similarity. The catch is that every answer is a coin flip: to learn a similarity to precision $\epsilon$ you must repeat the circuit about $1/\epsilon^2$ times. Each repetition is called a "shot." Most quantum machine-learning papers treat that cost as a constant overhead. We argue it is not constant when the task is medical diagnosis. Rare disease classes, and hospitals the model was not trained on, produce exactly the small similarity margins where coin-flip noise decides the answer. A quantum similarity oracle therefore spends its shots where they matter least. It fails first on the patients who matter most, and plain accuracy will not show this.

We propose to measure and then fix this failure. The testbed is a prototype classifier: an image is assigned to the class whose stored "average examples" (prototypes, held as several sub-centroids per class) it most resembles. Those similarities are computed by simulated swap tests with exact finite-shot sampling, on multi-hospital dermoscopy and head-CT data with severe class skew. The fix is a sequential readout. It corrects the scores for class frequency first and then spends extra shots only on the classes that are still competing for the prediction. The deliverable is a concrete requirement: how many shots per diagnosis a quantum oracle needs to match an exact classical prototype classifier on balanced accuracy and rare-class recall. We also report how much prior-corrected adaptive readout reduces that number.

Core Claim

Under a fixed total shot budget, uniform swap-test readout degrades rare-class recall much faster than overall accuracy. The degradation is worse on a held-out hospital than on the training hospitals. A readout that applies a class-frequency correction to the noisy similarity scores and then allocates shots sequentially to the top competing classes should close most of that gap at a fraction of the uniform budget.

The mechanism is simple. The swap test yields an ancilla outcome with probability $P(0) = \tfrac12 + \tfrac12 F$, where $F = |\langle\psi|\phi\rangle|^2$ is the fidelity between the query state and a prototype state. The estimator $\hat F = 2\hat p - 1$ from $s$ shots therefore has variance

$$ \mathrm{Var}(\hat F) = \frac{(1+F)(1-F)}{s}, $$

which follows directly from the Bernoulli variance $p(1-p)/s$ with $p = (1+F)/2$. Noise is largest at intermediate fidelities, which is where confusable classes sit.

The misclassification probability for a query depends on the gap between the best and second-best class scores relative to this noise. We hypothesize, and will test, two things. First, minority-class queries and target-site queries have systematically smaller gaps. Second, the class-frequency correction a practitioner needs for rare-class recall changes which classes are "second-best." If both hold, the correction must be applied inside the shot-allocation loop, not after it. That interaction is the part we believe is new. Neither adaptive sampling alone nor imbalance correction alone captures it.

Relation to Prior Work

The quantum side supplies the method. The theory of the quantum kernel-based binary classifier shows that the swap test evaluates the Hilbert–Schmidt overlap $\mathrm{Tr}(\rho\tilde\rho)$, which is a valid kernel. It also shows that a class centroid can be stored as a mixed state. We use this to represent each class as an equal mixture of its sub-centroid states, so a single swap test against the mixture estimates the average fidelity to the sub-centroids. Compact quantum kernel-based binary classifier shows that class imbalance can be compensated inside the circuit by a single ancilla rotation. Mathematically this amounts to reweighting class contributions, a prior correction. We adopt it as the correction step and make no claim of novelty for it. That paper evaluates only small tabular sets and never studies how the correction interacts with shot noise.

The quantum side also constrains the design. Quorum detects rare breast-cancer anomalies with training-free swap-test fidelities. It needed 1,000 random circuits and high shot budgets to reach stable scores, which is direct evidence that shot cost is the binding constraint. Its advantage over trained quantum neural networks also warns us away from gradient-trained circuits. Quantum-inspired classification via efficient simulation of Helstrom measurement finds that adding state copies improves discrimination non-monotonically. This is a reminder that "more quantum resource" is not automatically better, and one of our checks tests whether the same holds for sub-centroid count $K$. TrustworthyQENN performs complex-valued contrastive learning across sensor domains, but it runs entirely in classical floating point. It therefore says nothing about finite-shot readout, which is our entire subject.

On the medical side, Non-parametric regularization for class imbalance federated medical image classification (FedNPR) motivates the design and supplies the classical classifier. It shows that domain shift combined with local class imbalance corrupts linear classification heads. It replaces them with contrastive alignment to $K$ sub-centroids per class, assigned by Sinkhorn-Knopp, plus Balanced Softmax, a loss that shifts decision margins by class frequency. We keep this geometry exactly and change only how similarities are read out. RPN Prototype Alignment and Robust Federated Learning on Edge Devices with Domain Heterogeneity establish prototype contrastive alignment across domains. The first also documents confirmation bias when target prototypes are built from pseudo-labels. We expect shot noise to amplify that bias and will measure it. From Theory to Decision Rule shows that noisy labels on imbalanced medical benchmarks can cost up to 0.10 AUC past a crossover point. That result frames our worry that readout noise behaves like structured label noise concentrated on rare classes.

Research Program

The classical backbone is trained once, with no quantum involvement. A pretrained image encoder is fine-tuned on the source hospitals with FedNPR-style sub-centroid contrastive alignment and Balanced Softmax. Its embeddings are projected to $2^n$ dimensions with $n$ between 6 and 10, and then normalized. Because swap-test fidelity squares the inner product and discards its sign, the projection is trained with the squared-cosine similarity in place of cosine. This keeps the classical and quantum classifiers on the same scoring function. The effect of the sign loss is reported separately.

Amplitude-encoded states are simulated exactly at these sizes, and each swap test is sampled as a binomial draw from the exact $P(0)$. The simulation is therefore faithful to the statistics of an ideal device. At the smallest sizes we add a depolarizing noise model to check that conclusions survive hardware-like errors.

The sequential readout works in rounds. It first spends a small warm-up budget on every class prototype. It adds the log class prior (the Balanced Softmax correction, equivalently the compact classifier's rotation angle) to each fidelity estimate. It then drops classes whose corrected upper confidence bound falls below the leader's lower bound, and spends the next round's shots only on the survivors. The loop stops when one class remains or the per-query budget runs out.

On the held-out target hospital, we also run the transductive variant. Target sub-centroids are refined from pseudo-labels produced by this noisy readout, which lets us measure whether shot noise feeds back into prototype drift.

Baselines

The naive reference point is uniform readout. Every class prototype receives the same number of shots, scores are compared, and no prior correction is applied. It is run at total budgets from 10² to 10⁵ shots per query, matched shot-for-shot against every other method. It shows the raw cost of treating the oracle as a black box.

The strongest existing method is the exact classical prototype classifier: FedNPR geometry with exact inner products and Balanced Softmax. It uses the identical backbone, projection, and sub-centroids, with the same tuning budget for $K$ and temperature, so the only difference is readout noise. It is the ceiling, not something we expect to beat. The quantitative target is to reach within one point of its balanced accuracy and rare-class recall at the smallest possible shot budget. The reported reference for this geometry is FedNPR-Per at 76.2% balanced accuracy on Fed-ISIC2019 and 72.1% on RSNA-ICH, from Non-parametric regularization for class imbalance federated medical image classification. Our held-out-hospital protocol, frozen encoder, and small projection differ from that paper's personalized federated setting, so we reproduce the exact classifier in our own protocol rather than compare against 76.2% directly. No reported result was found on Lacuna for swap-test prototype classification on these datasets.

Two ablations isolate the key ingredient. The first is adaptive readout with the prior correction applied only after sampling ends: standard best-arm identification on raw fidelities. The second is uniform readout with the prior correction applied. Our claim holds only if the full method beats both at matched budget on rare-class recall. If it does not, the interaction we hypothesize is not real. A further ablation replaces the $K$-sub-centroid mixture state with a single-prototype state, to test whether the mixed-state representation of the Hilbert–Schmidt kernel theory preserves FedNPR's gains under noise.

Why not just…?

Why not just compute cosine similarity classically? At 256 dimensions, classical computation is far cheaper, and we say so plainly. This work does not claim a speedup. It is a requirements study for the regime where data already lives as quantum states and similarity must be read out by interference, the regime assumed by the QRAM-based proposals the file surveys. Any claim of quantum benefit elsewhere implicitly assumes shot costs that nobody has measured on imbalanced, shifted clinical data. The exact classical classifier is included precisely to price the gap.

Why not just use more shots uniformly? This is the real threat, because more shots always converges to the exact classifier. The question is whether the budget is affordable. Quorum's reliance on 1,000-circuit ensembles and high shot counts (Quorum) suggests it is not. The budget sweep settles this directly. If uniform readout matches the exact classifier's rare-class recall with at most twice the shots of our method, the method is not worth its complexity, and we will report that.

Why not just run off-the-shelf adaptive sampling and correct for imbalance afterwards? This is the first ablation. If the prior shifts which classes compete, post-hoc correction wastes shots separating majority classes that the correction would have demoted anyway. If our hypothesis is wrong, this ablation will tie the full method, and the contribution reduces to the measurement study.

Why not just rebalance the data with generative augmentation? GAN balancing helped classification in RECOD Titans at ISIC 2018. It acts on training, however, while our failure mode is at readout, where margins shrink regardless of how the backbone was trained. We test this by retraining the backbone with class-balanced sampling and checking whether the uniform-readout recall gap persists.

Proposed Experiments

The data are Fed-ISIC2019 (eight-class dermoscopy across hospitals) and RSNA-ICH (head-CT hemorrhage). Each hospital is held out in turn as the target domain, and the rest serve as sources. The metrics are balanced accuracy, per-class recall with emphasis on the rarest classes, and shots-per-query needed to come within one point of the exact classifier. We also track target-prototype drift across pseudo-label refinement rounds.

The decisive checks are four. First, under uniform readout, rare-class recall should fall measurably faster than balanced accuracy as the budget shrinks, and faster on target than source hospitals. If it does not, the premise fails. Second, the measured score gaps for minority and target queries should be smaller, with error rates tracking the variance formula above. Third, the full method should beat both ablations on rare-class recall at matched budget. Fourth, the sweep over $K$ tests whether more sub-centroids help monotonically once noise is present, or whether they peak as copies did in the Helstrom simulation study, since extra sub-centroids average down fidelities and shrink margins.