IEEE Access
Statistical Hypothesis Testing for Efficient Black-Box Quantum Program Testing
Tiancheng Jin, Bo Yang, Haibo Yu, Jianjun Zhao
Abstract
Quantum computing offers exponential computational advantages across diverse application domains, yet the inherent probabilistic nature of quantum measurements poses challenges for program testing. Existing quantum black-box testing approaches rely on ad-hoc tolerance checks applied to empirical probability distributions estimated from large measurement samples, often requiring a large number of measurements, because of lacking formal Type I error control, power guarantees, or principled sample size determination. We present a statistical hypothesis-testing method for quantum program testing, encompassing two paradigms: marginal probability testing and joint distribution testing over the full$2^{d}$-dimensional state space. By combining exact and asymptotic tests, bootstrap procedures, sequential designs, and kernel-based two-sample testing, our method provides rigorous error control with substantially improved sample efficiency. Experiments on quantum programs with 2 to 12 qubits show measurement reductions from 97 to 99 percent over the conventional practice of ten thousand shots against strong synthetic faults. A structural mutation study separates the faults that every test detects at one hundred measurements from those that no measurement-based test can detect. The exact marginal test, the exact branch of the sequential design, and the permutation-calibrated joint tests control the Type I error rate at or below the nominal level of 0.05. The adaptive chi-square branch is mildly anticonservative on random states, with a median of 0.060, and conservative on the named benchmarks. On QFT, the sequential design rejects a faulty program with 32 to 85 percent fewer measurements than a properly powered fixed-sample test at two to twelve qubits on its adaptive branch, and with 19 to 60 percent fewer on its exact branch, which is valid under any dependence and reaches the target power from four qubits upward. Power exceeds 0.80 above a characterized fault strength, and faults that preserve the output distribution are shown to be undetectable by any measurement-based test. These results establish a principled and practical foundation for quantum program testing.