Noise-aware variational quantum classifier training: comparing training under simulated depolarizing noise vs ideal-statevector training, evaluating both robustness to test-time noise and clean-test transfer

Real quantum hardware exhibits gate errors, readout errors, and
decoherence at rates that vary across devices. A VQC trained on a
noiseless statevector simulator may converge to parameters that work
on the ideal training distribution but degrade sharply when deployed
on a noisy device. The noise-aware training strategy is to inject
simulated noise during training (e.g. a depolarizing channel after
each two-qubit gate) so the optimizer can find parameters that are
robust to that noise model. The closest classical analog is
adversarial training or training-time data augmentation.

Two open empirical questions follow. First, does noise-aware training
produce strictly more robust models on noisy test data than ideal
training, and at what training noise rate is the robustness gain
worth the loss of clean-test accuracy? Second, does training at high
noise (p=0.01) cause negative transfer to clean test data — i.e.
does the model overfit to the noise statistics and underperform an
ideal-trained model on noise-free evaluation? Wang et al. (NeurIPS
2022 "QuantumNAS: Noise-Adaptive Search for Robust Quantum
Circuits") and Sharma et al. (PRX Quantum 2022 "Trainability of
dissipative perceptron-based quantum neural networks") explored
these tradeoffs at small scale, leaving the precise sweet-spot
noise rate as a benchmark question.

Implementation guidance is provided by the quantum-qiskit skill at
stage 10. Use qiskit_aer.AerSimulator with a custom NoiseModel that
applies a single-qubit and two-qubit depolarizing channel after each
parameterized gate. The training uses
qiskit_machine_learning.algorithms.VQC with a custom
qiskit.primitives.BackendSamplerV2 bound to the noisy AerSimulator
for noisy-train conditions, and the noiseless reference
qiskit.primitives.StatevectorSampler for the ideal-train condition.
Evaluation always runs on both an ideal statevector test set and a
noisy test set at p=0.01 (the "deployment noise rate") so each cell
produces two test_accuracy values: clean and noisy. The primary
metric is the average across both.

Experimental protocol. Four quantum training conditions vary the
training noise rate: ideal (p=0), low noise (p=0.001), mid noise
(p=0.005), high noise (p=0.01). Two baselines complete the bench
gate: a no-training control (random initialization, no fit) and
logistic regression on the same 4D features. All six conditions
are evaluated on a single synthetic binary classification dataset
(make_classification with class_sep=0.5, 200 samples, 4 features),
averaged over 3 seeds. Total: 6 conditions x 1 dataset x 3 seeds
= 18 cells.

Research question: *On a synthetic 4D binary classification task,
does noise-aware VQC training at a moderate training noise rate
(p=0.005) produce a model that is more robust to test-time
depolarizing noise (p=0.01) than an ideal-trained VQC, and does
high training noise (p=0.01) cause negative transfer to clean
test data?*

On the noisy test set at p=0.01, the noisy-trained-mid VQC (training noise p=0.005) achieves test accuracy at least 5 absolute percentage points higher than the ideal-trained VQC (3-seed mean), demonstrating that moderate noise-aware training improves test-time noise robustness.

On the ideal test set (noiseless), the ideal-trained VQC outperforms every noisy-trained variant by at least 2 absolute percentage points (3-seed mean), reflecting the no-free-lunch tradeoff that noise-aware training sacrifices some clean-test accuracy.

The high-noise-trained VQC (training noise p=0.01) performs worse than the mid-noise-trained VQC on BOTH clean and noisy test sets (3-seed mean), indicating that p=0.01 is past the sweet spot and the optimizer is overfitting to noise statistics — negative transfer.

Does noise-aware VQC training at a moderate training noise rate (p=0.005) produce a model more robust to test-time depolarizing noise than ideal training, and does high training noise cause negative transfer on clean test data?

VQC trained on noiseless qiskit.primitives.StatevectorSampler. EfficientSU2(num_qubits=4, reps=2, entanglement='linear') ansatz + ZFeatureMap feature map. qiskit_machine_learning.VQC(optimizer=COBYLA(maxiter=200), sampler=StatevectorSampler()). After training, evaluate on BOTH ideal test (StatevectorSampler) and noisy test (depolarizing p=0.01 NoiseModel).

Same ansatz + feature map. VQC trained on a noisy AerSimulator with depolarizing channel p=0.001 applied after every single-qubit and two-qubit gate. Same COBYLA maxiter=200. Evaluate on both ideal and noisy test sets.

Same as train_noisy_low but training noise rate p=0.005.

Same as train_noisy_low but training noise rate p=0.01 (matches the test-noise rate).

no_training_control: Same ansatz but parameters randomly initialized and never trained. Evaluate predict() directly on both test sets. Establishes the untrained floor.

logistic_regression: sklearn.linear_model.LogisticRegression(max_iter=1000, random_state=seed) on the same 4 features. Classical baseline.

Average of test_accuracy_ideal and test_accuracy_noisy_p01, 3-seed mean. Primary metric for the bench.

Test accuracy on the noiseless test set (StatevectorSampler evaluation), 3-seed mean.

Test accuracy on the noisy test set at depolarizing rate p=0.01 (AerSimulator with NoiseModel), 3-seed mean. The 'deployment-noise' robustness metric.

make_classification(n_samples=200, n_features=4, n_informative=3, n_redundant=0, n_clusters_per_class=1, class_sep=0.5, flip_y=0.05, random_state=seed). Moderately difficult binary classification, native 4D. StandardScaler fit on train only. 80/20 split.

An empirical study of noise-aware VQC training. Four quantum training conditions vary the training-time depolarizing noise rate (ideal, p=0.001, p=0.005, p=0.01), evaluated on both an ideal test set and a noisy test set at p=0.01. The agent must (a) implement the noise model via qiskit_aer.NoiseModel applying single-qubit and two-qubit depolarizing channels, (b) train VQC under each noise level using qiskit_machine_learning.VQC with the appropriate sampler, (c) evaluate each trained model on BOTH ideal and noisy test sets to expose the robustness-vs-clean-accuracy tradeoff, and (d) score H1/H2/H3 with numerical evidence.

Noise-aware training studies are scored on (i) correctness of the qiskit_aer NoiseModel construction (depolarizing channel must be applied after every gate, not only after measurement; verifiable by inspecting the agent's noise model setup), (ii) test_accuracy reporting BOTH ideal and noisy variants per cell (without both, H1 cannot be evaluated), (iii) the noise-rate sweep producing visibly different test accuracies (cells reporting identical numbers across noise levels indicate the noise model is not actually being applied during training), and (iv) numerical evidence backing the three-way comparison: ideal-train vs noisy-mid-train vs noisy-high-train.

Code-development bucket: NoiseModel correctly constructed, training pipeline applies noise, evaluation on both ideal and noisy test.

qiskit_aer.NoiseModel with depolarizing_error applied to all single-qubit gates (h, ry, rz, etc.) AND two-qubit gates (cx). For a noisy-train condition at rate p, the single-qubit error rate is p and the two-qubit error rate is p (or some agent-documented scaling of p). A sanity check verifies that the same ansatz parameters produce different expectation values under the noise model vs under StatevectorSampler (otherwise the noise is not being applied).

Each training condition uses qiskit_machine_learning.VQC with a qiskit.primitives.BackendSamplerV2 (or BackendSampler) bound to either AerSimulator (for noisy training) or StatevectorSampler (for ideal training). Same ansatz family (EfficientSU2 num_qubits=4 reps=2 entanglement='linear'), same optimizer (COBYLA maxiter=200), same per-seed random initialization across noise-rate conditions for paired comparison.

Each trained VQC is evaluated on TWO test sets: (a) ideal StatevectorSampler (test_accuracy_ideal), (b) noisy AerSimulator at depolarizing p=0.01 (test_accuracy_noisy_p01). Both numbers are logged per cell. The primary 'test_accuracy' metric is the average of the two. Each cell's METRIC_RESULT JSON includes all three numbers.

Execution-validity bucket: all 18 cells ran with valid outputs.

At least 16 cells out of 18 expected (6 conditions x 1 dataset x 3 seeds) completed without unhandled errors and produced both test_accuracy_ideal AND test_accuracy_noisy_p01 values. Missing more than 2 cells (10 percent) without documented justification fails this leaf.

Numerical validity: both test accuracies in [0, 1]; for any single training condition, test_accuracy_ideal and test_accuracy_noisy_p01 differ by at least 0.01 (cells reporting bit-identical clean and noisy accuracy mean the noise model isn't being applied at evaluation); no_training_control accuracy is in [0.4, 0.6] (random predictor floor).

Results bucket: quantitative tests of H1/H2/H3 plus a per-hypothesis writeup.

Quantitative test of H1. On the noisy test set at p=0.01, is train_noisy_mid (training noise p=0.005) test_accuracy >= train_ideal test_accuracy + 5 absolute pp (3-seed mean)? 100% if gap >= 5pp, 67% if 2-5pp, 33% if any positive gap, 0% if ideal train matches or beats noisy-mid train on noisy test.

Quantitative test of H2. On the ideal test set, does train_ideal beat EVERY noisy-trained variant by >= 2 absolute pp (3-seed mean)? 100% if gap >= 2pp vs all three noisy variants, 67% if gap >= 2pp vs at least 2 of 3, 33% if marginal advantage on at least 1, 0% if noisy training matches or beats ideal training on clean test (no tradeoff).

Quantitative test of H3. Does train_noisy_high underperform train_noisy_mid on BOTH the clean and the noisy test set (3-seed mean)? 100% if cleanly worse on both, 67% if worse on 1 of 2 by >= 3pp, 33% if marginally worse on 1, 0% if high-noise training matches or beats mid-noise on both test sets (no negative transfer observed).

Writeup of at least 200 words (submission/README.md ## Agent-produced writeup section) with explicit supported / refuted / inconclusive verdict for each of H1/H2/H3 backed by per-(training_noise_rate, test_set) 3-seed mean accuracy values. References Wang NeurIPS 2022 QuantumNAS and Sharma PRX Quantum 2022. Discusses whether the observed sweet-spot noise rate matches the test-deployment rate, and acknowledges that AerSimulator depolarizing channel is a simplified model relative to real hardware noise (T1/T2, crosstalk, readout asymmetry not captured).


Quantum autoencoder for pure-state compression: training a parameterized circuit to compress n-qubit Haar-random states into m<n latent qubits via SWAP-test loss, measuring reconstruction fidelity vs compression ratio

A quantum autoencoder takes an n-qubit quantum state, applies a
parameterized circuit that disentangles the information onto a
smaller subset of m < n "latent" qubits, and traces out the
remaining n - m "trash" qubits. The latent qubits are then expanded
back to n qubits via a fresh ancilla register and a decoder circuit
(typically the conjugate of the encoder). Training optimizes the
encoder so the trash qubits end in the |0> state (verified via a
SWAP test against fresh |0> ancillas), which is equivalent to
maximizing the fidelity between the reconstructed state and the
original input state.

The training data is an ensemble of input states drawn from some
distribution. If the ensemble is concentrated in a low-dimensional
manifold of the 2^n Hilbert space, the autoencoder can in principle
reach near-perfect reconstruction at significant compression (m <
n). If the ensemble is Haar-random pure states, no compression is
achievable in principle and the average reconstruction fidelity is
upper bounded by 2^(m-n) (the latent space is too small to hold a
generic state).

The empirical question this topic addresses is what compression
fidelity is achievable on a small Haar-random ensemble at a few
compression ratios, and whether the trained autoencoder
meaningfully beats a random-unitary baseline (which represents the
null hypothesis: a random encoder cannot do better than chance).
This is the cleanest possible test of "does the autoencoder learn
anything" without confounding from structured ensembles.

Implementation guidance is provided by the quantum-qiskit skill at
stage 10. The encoder and decoder are EfficientSU2(num_qubits=n,
reps=3, entanglement='linear') circuits built from
qiskit.circuit.library. The SWAP-test loss is implemented manually
via auxiliary qubits and a Hadamard-controlled-SWAP-Hadamard pattern.
Use qiskit.primitives.StatevectorSampler for the SWAP-test
measurement and qiskit.primitives.StatevectorEstimator for the
reconstruction-fidelity diagnostic. Training uses
qiskit_algorithms.optimizers.COBYLA.minimize() over the SWAP-test
loss (DO NOT use qiskit_algorithms.VQE — see the quantum-qiskit
skill's note about qiskit 2.x compatibility).

Experimental protocol. Three quantum compression conditions probe
the compression-fidelity tradeoff: compress 4 qubits -> 2 latent,
compress 4 -> 3, compress 6 -> 3. Two no-skill baselines establish
the floor: no_compression (identity encoder, m=n, fidelity should
be ~1.0) and random_unitary_compression (encoder parameters drawn
randomly and never trained). Test data is an ensemble of 20
Haar-random pure states per seed. Each (condition, seed) cell
reports the mean reconstruction fidelity over the 20 test states.
Total: 5 conditions x 1 ensemble x 3 seeds = 15 cells.

Research question: *On an ensemble of Haar-random pure states, what
reconstruction fidelity does a trained quantum autoencoder achieve
at compression ratios 4->2, 4->3, and 6->3, and how much better is
it than an untrained (random-unitary) encoder at the same
compression ratio?*

The trained autoencoder achieves reconstruction fidelity at least 0.2 absolute higher than a random-unitary encoder at the same compression ratio (3-seed mean across the 20 Haar test states), on at least 2 of 3 compression-ratio conditions, confirming that training extracts non-trivial structure from the Haar ensemble.

Trained reconstruction fidelity is strictly monotone in latent dimension: the 4->3 condition achieves fidelity at least 0.15 higher than the 4->2 condition (3-seed mean), as expected from the Hilbert-space capacity argument 2^m / 2^n.

The no_compression baseline (identity encoder, m=n) achieves reconstruction fidelity at least 0.95 (3-seed mean), confirming the experimental setup is correctly implemented — the trash-qubit register is non-functional when m=n and the test pipeline should report near-perfect fidelity.

On an ensemble of Haar-random pure states, what reconstruction fidelity does a trained quantum autoencoder achieve at compression ratios 4->2, 4->3, 6->3, and how much better is it than an untrained encoder at the same compression?

Encoder: EfficientSU2(num_qubits=4, reps=3, entanglement='linear'). After applying the encoder, qubits 2 and 3 are the 'trash' register and the SWAP test against fresh |0> ancillas is summed into the loss. Latent qubits: 0, 1. Decoder is the inverse encoder. Training: 100 iterations of qiskit_algorithms.optimizers.COBYLA(maxiter=100).minimize() on a fixed batch of 5 Haar-random states drawn once per seed.

Same as compress_4_to_2 but with 1 trash qubit (qubit 3) and 3 latent qubits (0, 1, 2). Easier compression task.

Encoder: EfficientSU2(num_qubits=6, reps=3, entanglement='linear'). 3 trash qubits (3, 4, 5) and 3 latent qubits (0, 1, 2). Harder compression task (50 percent compression on a larger Hilbert space).

no_compression: Encoder is the identity circuit (no parameters). All qubits are latent (m=n); no trash qubits. The SWAP test trivially passes and reconstruction fidelity equals 1.0 exactly. Sanity check on the eval pipeline.

random_unitary_compression: Same EfficientSU2 ansatz as the trained conditions, but parameters drawn randomly from Uniform[-pi, pi] once per seed and NEVER trained. Establishes the no-skill floor — represents 'what if the encoder is just random noise'.

Mean of |<psi_input|psi_reconstructed>|^2 over the 20 Haar-random test states, 3-seed mean. Primary metric. Computed as 1 - SWAP_test_probability_of_outcome_1 averaged over the trash qubits, OR via direct Statevector inner product when running on the noiseless simulator.

Training loss at the final iteration. Sum over the m trash qubits of P(SWAP_test_outcome=1) on each. Equivalent to 1 - average_trash_qubit_fidelity_with_|0>.

Wall-clock seconds for the 100 COBYLA iterations of training. Reported for context — the compression task should fit well under 60 seconds per cell.

qiskit.quantum_info.random_statevector(2**4, seed=ensemble_seed) — generate 20 Haar-random 4-qubit pure states with a fixed per-seed ensemble seed

An ensemble of 20 Haar-random 4-qubit pure states (for compress_4_to_2 and compress_4_to_3 conditions). A separate Haar ensemble of 20 6-qubit states is generated for the compress_6_to_3 condition. Training uses a fixed batch of 5 of these states; testing uses all 20. The ensemble is fully unstructured by construction, so any non-trivial reconstruction fidelity above the random-unitary baseline reflects the autoencoder learning a structured compression rule on Haar states.

An empirical study of a quantum autoencoder on Haar-random pure states. The agent must (a) construct encoder + decoder circuits as EfficientSU2(reps=3) from qiskit.circuit.library, (b) implement the SWAP-test loss via auxiliary qubits + Hadamard-controlled-SWAP-Hadamard or compute trash-qubit fidelity-to-|0> directly via Statevector, (c) train each compression-ratio condition by qiskit_algorithms.optimizers.COBYLA.minimize() on a fixed batch of 5 Haar states per seed, (d) evaluate on 20 unseen Haar states reporting reconstruction_fidelity, and (e) score H1/H2/H3 with numerical evidence.

Quantum autoencoder studies are scored on (i) correctness of the SWAP-test or fidelity computation (verifiable: no_compression baseline must report fidelity ~1.0, otherwise the eval pipeline is broken), (ii) the random_unitary_compression baseline producing fidelity in the expected range for that compression ratio (theoretical floor is 2^(m-n) per Page formula, e.g. for 4->2 the random baseline fidelity is around 0.0625), (iii) the trained conditions being measurably above the random baseline (otherwise no learning), and (iv) numerical evidence for the latent-dimension capacity effect (4->3 better than 4->2).

Code-development bucket: encoder/decoder built from qiskit.circuit.library, SWAP-test or direct-fidelity loss implemented correctly, training pipeline runs.

Encoder is qiskit.circuit.library.EfficientSU2(num_qubits=n, reps=3, entanglement='linear'). Decoder is the inverse of the encoder (via QuantumCircuit.inverse()) sharing the same parameters but acting in reverse, applied after fresh |0> ancillas have replaced the trash qubits. Both encoder and decoder are built once from qiskit.circuit.library — NOT hand-coded as H/RY/RZ + CNOT stacks (the quantum-qiskit skill warns against this anti-pattern).

Training loss is implemented as either (a) a SWAP-test circuit using auxiliary qubits and the standard Hadamard-controlled-SWAP-Hadamard pattern, OR (b) a direct Statevector computation: trace out the trash register, compute its partial-trace overlap with |0><0|, and sum across trash qubits. Both implementations are valid. The reconstruction_fidelity metric on the test set uses |<psi_input|psi_reconstructed>|^2 computed via qiskit.quantum_info.Statevector inner product (no SWAP test needed at evaluation since we have access to both states).

Training: 100 iterations of qiskit_algorithms.optimizers.COBYLA.minimize() over the SWAP-test loss, summed over a fixed batch of 5 Haar-random states drawn once per (condition, seed) pair via qiskit.quantum_info.random_statevector. Evaluation: 20 fresh Haar-random states drawn from a different RNG stream than the training batch. Each cell logs METRIC_RESULT JSON with condition, seed, reconstruction_fidelity_mean (over 20 test states), swap_test_loss_final, training_time_sec.

Execution-validity bucket: all 15 cells ran with valid outputs.

At least 14 cells out of 15 expected (5 conditions x 1 ensemble x 3 seeds) completed without unhandled errors and produced a reconstruction_fidelity_mean value. Missing more than 1 cell without documented justification fails this leaf.

Numerical validity: reconstruction_fidelity is in [0, 1] for every cell; the no_compression baseline reports fidelity in [0.95, 1.0] (else eval pipeline is broken); the random_unitary_compression baseline for 4->2 reports fidelity in [0.04, 0.15] (matching the theoretical 2^(m-n) = 0.0625 average for Haar states); no cell reports identical fidelity across all 3 seeds (would indicate the Haar sampler is not actually randomizing per seed).

Quantitative test of H1. On at least 2 of 3 compression-ratio conditions, is trained reconstruction_fidelity >= random_unitary_compression reconstruction_fidelity + 0.2 absolute (3-seed mean)? 100% if gap >= 0.2 on at least 2/3 conditions, 67% if gap >= 0.1 on at least 2/3, 33% if any positive gap on at least 1, 0% if random unitary equals or beats trained on all 3.

Quantitative test of H2. Is reconstruction_fidelity(compress_4_to_3) - reconstruction_fidelity(compress_4_to_2) >= 0.15 absolute (3-seed mean)? 100% if gap >= 0.15, 67% if 0.05-0.15, 33% if any positive gap (capacity effect at least directionally correct), 0% otherwise.

Quantitative test of H3. Does no_compression baseline report reconstruction_fidelity >= 0.95 (3-seed mean)? 100% if >= 0.95, 67% if >= 0.85, 33% if >= 0.70, 0% otherwise — failure of this sanity check means the eval pipeline is misconstructed.

Writeup of at least 200 words (submission/README.md ## Agent-produced writeup section) with explicit supported / refuted / inconclusive verdict for each of H1/H2/H3 backed by 3-seed mean reconstruction_fidelity per condition. References Romero, Olson, Aspuru-Guzik Quantum Sci Tech 2017 and discusses whether the trained autoencoder's advantage over random_unitary_compression on Haar-random data is consistent with the Page-formula expectation (Haar states have no exploitable structure, so any improvement reflects the optimizer finding a non-trivial subspace).