An adapter turns a Workload Passport into probabilities on its backend, then follows a fixed sampling contract so that the output is bit-identical to every other compliant backend for the same inputs.
Sampling contract v0.1
- Compute the exact outcome probabilities p[i] for i = 0 … 2ⁿ−1 (index bit q = qubit q). With depolarizing(p), evolve a density matrix and, after every gate, map each touched qubit ρ → (1−p)ρ + p·(I/2 ⊗ Tr_q ρ). This matches pyqpanda3’s depolarizing_error on DensityMatrixSimulator.
- Build the cumulative sum cdf[i] = p[0] + … + p[i] in that order.
- Seed the mulberry32 PRNG with the passport seed (32-bit integer arithmetic).
- For each shot: u = rnd() × cdf[last]; take the first i with u ≤ cdf[i] (stop at the last index).
- If readout noise p > 0: for q = 0 … n−1, if rnd() < p flip bit q of i.
- Count outcomes; omit zero counts; hash with the canonical JSON rules.
Registered backend ids
| Backend id | Implementation | Status |
|---|---|---|
| browser.statevector.fp64 | src/scripts/qsim.ts (in-browser) | Reference, unit-tested |
| cpu.reference.fp64 | connectors/cuquantum (pure Python) | Parity verified against browser |
| gpu.custatevec.fp64 | connectors/cuquantum (NVIDIA cuStateVec) | Code ready; GPU parity test pending |
| cpu.tensornet.fp64 | connectors/cuquantum (tensor network, NumPy) | Parity verified against browser |
| gpu.cutensornet.fp64 | connectors/cuquantum (NVIDIA cuTensorNet) | Code ready; GPU parity test pending |
| cpu.qpanda3.statevector | connectors/cuquantum (Origin Quantum pyqpanda3 CPUQVM) | Parity verified against browser |
| qcloud.origin.<backend> | connectors/cuquantum (Origin Quantum Cloud, pyqpanda3.qcloud) | Statistical only; adapter untested (needs API key) |
Certification levels
- Schema-compatible — accepts and emits the passport format.
- Simulator-verified — passes the parity fixtures exactly.
- Cloud-verified — end-to-end job flow passes on the provider’s cloud.
- Hardware-verified — runs on real hardware with full passport metadata (hardware results are not expected to match simulator hashes; they are compared statistically).
Floating-point differences in the last bits can, in rare cases, move a sample across a probability boundary. Parity fixtures detect this; adapters must report it rather than hide it.