Table of Contents
Fetching ...

The Cost of Certainty: Shot Budgets in Quantum Program Testing

Andriy Miranskyy

TL;DR

The paper develops a unified framework for budgeting the number of measurements needed to verify quantum programs, connecting state discrimination bounds (Quantum Chernoff bound) with practical tests (inverse, swap, and chi-square). It derives closed-form shot estimates under ideal and noisy conditions and introduces a program-level budgeting approach based on the Bures angle to distribute fidelity targets across components. Key findings show inverse tests are most shot-efficient, swap tests require about twice as many shots, and chi-square tests can be prohibitively costly, especially as fidelity targets grow or the bin count increases. Noise modelling reveals substantial inflation of required shots beyond asymptotic bounds unless calibrated baselines are used. The framework provides actionable guidance for practitioners on selecting verification strategies and allocating verification resources across complex quantum programs, balancing rigor and cost, with several illustrative examples and a GitHub demonstration.

Abstract

As quantum computing advances toward early fault-tolerant machines, testing and verification of quantum programs become urgent but costly, since each execution consumes scarce hardware resources. Unlike in classical software testing, every measurement must be carefully budgeted. This paper develops a unified framework for reasoning about how many measurements are required to verify quantum programs. The goal is to connect theoretical error bounds with concrete test strategies and to extend the analysis from individual tests to full program-level verification. We analyze the relationship between error probability, fidelity, trace distance, and the quantum Chernoff bound to establish fundamental shot count limits. These foundations are applied to three representative testing methods: the inverse test, the swap test, and the chi-square test. Both idealized and noisy devices are considered. We also introduce a program-level budgeting approach that allocates verification effort across multiple subroutines. The inverse test is the most measurement efficient, the swap test requires about twice as many shots, and the chi-square test is easiest to implement but often needs orders of magnitude more measurements. In the presence of noise, calibrated baselines may increase measurement requirements beyond theoretical estimates. At the program level, distributing a global fidelity target across many fine-grained functions can cause verification costs to grow rapidly, whereas coarser decompositions or weighted allocations remain more practical. The framework clarifies trade-offs among different testing strategies, noise handling, and program decomposition. It provides practical guidance for budgeting measurement shots in quantum program testing, helping practitioners balance rigour against cost when designing verification strategies.

The Cost of Certainty: Shot Budgets in Quantum Program Testing

TL;DR

The paper develops a unified framework for budgeting the number of measurements needed to verify quantum programs, connecting state discrimination bounds (Quantum Chernoff bound) with practical tests (inverse, swap, and chi-square). It derives closed-form shot estimates under ideal and noisy conditions and introduces a program-level budgeting approach based on the Bures angle to distribute fidelity targets across components. Key findings show inverse tests are most shot-efficient, swap tests require about twice as many shots, and chi-square tests can be prohibitively costly, especially as fidelity targets grow or the bin count increases. Noise modelling reveals substantial inflation of required shots beyond asymptotic bounds unless calibrated baselines are used. The framework provides actionable guidance for practitioners on selecting verification strategies and allocating verification resources across complex quantum programs, balancing rigor and cost, with several illustrative examples and a GitHub demonstration.

Abstract

As quantum computing advances toward early fault-tolerant machines, testing and verification of quantum programs become urgent but costly, since each execution consumes scarce hardware resources. Unlike in classical software testing, every measurement must be carefully budgeted. This paper develops a unified framework for reasoning about how many measurements are required to verify quantum programs. The goal is to connect theoretical error bounds with concrete test strategies and to extend the analysis from individual tests to full program-level verification. We analyze the relationship between error probability, fidelity, trace distance, and the quantum Chernoff bound to establish fundamental shot count limits. These foundations are applied to three representative testing methods: the inverse test, the swap test, and the chi-square test. Both idealized and noisy devices are considered. We also introduce a program-level budgeting approach that allocates verification effort across multiple subroutines. The inverse test is the most measurement efficient, the swap test requires about twice as many shots, and the chi-square test is easiest to implement but often needs orders of magnitude more measurements. In the presence of noise, calibrated baselines may increase measurement requirements beyond theoretical estimates. At the program level, distributing a global fidelity target across many fine-grained functions can cause verification costs to grow rapidly, whereas coarser decompositions or weighted allocations remain more practical. The framework clarifies trade-offs among different testing strategies, noise handling, and program decomposition. It provides practical guidance for budgeting measurement shots in quantum program testing, helping practitioners balance rigour against cost when designing verification strategies.
Paper Structure (52 sections, 88 equations, 4 figures)

This paper contains 52 sections, 88 equations, 4 figures.

Figures (4)

  • Figure 1: Number of measurement shots $N$ required to achieve error probability $P_{\mathrm{e}} = 0.05$ as a function of fidelity $F \in [0.001, 0.99999]$ (right pane).Curves are shown for the pure (or pure-mixed) case $N_{\text{pure}} = N_{\text{pure-mixed}}$ and for the lower and upper bounds of the mixed-mixed case $N_{\text{mixed}}$. As $F \to 0$, a single shot suffices; as $F \to 1$, the required shots diverge exponentially. To improve readability near $F=1$, the left pane re-expresses the data as a function of $1-F$, which makes the divergence more apparent.
  • Figure 2: Required number of shots for inverse, swap, and chi-square tests as a function of fidelity $F \in [0.900, 0.995]$. Parameters are fixed at $P_{\mathrm{e}} = \alpha = \beta = 0.01$. For the chi-square test, bin counts are varied over $k = 2, 4, 8, 16, 32, 64, 128$; inverse and swap tests are independent of $k$. The chi-square curves illustrate the wide range of possible sampling costs.
  • Figure 3: Shot-count requirements for \ref{['ex:noise_binomial']}, comparing binomial-based estimates with QCB-based estimates $N_{\text{inverse, real}}$ and $N_{\text{swap, real}}$ with $P_{\mathrm{e}}=0.01$ and $\kappa = 2$. The target probabilities are $q_1 \in \{0.90, 0.99\}$, while the calibrated noise baseline is $q_0 \in [0.991, 1.000]$. The values of the binomial test are computed using R power.prop.test function (package statsr2024) with Type I error $\alpha = 0.01$ and Type II error $\beta = 0.01$. The figure illustrates how shot counts grow rapidly as $q_1$ approaches $q_0$.
  • Figure 4: The number of measurement shots $N$ required to achieve error probability $P_{\mathrm{e}} = 0.05$ is shown as a function of the trace distance $T \in [0.001, 0.999]$ (right pane). The curves depict the pure-state case $N_{\text{pure}}$, as well as the lower and upper bounds for the pure-mixed case $N_{\text{pure-mixed}}$ and the mixed-state case $N_{\text{mixed}}$. As $T \to 0$, the required number of shots diverges exponentially; therefore, the left pane shows the same data plotted against $1-T$ for improved readability. Note that the upper bound of $N_{\text{pure-mixed}}$ coincides with $N_{\text{pure}}$.

Theorems & Definitions (2)

  • Example 3.1: Chi-square test at $F=0.999$
  • Example 3.2: Chi-square test at $F=0.99$