Bernstein-Vazirani is a convenient experiment for studying the usability of a quantum circuit. The ideal algorithm reveals a specified hidden bit string. On hardware the measured bit strings are distributed, so a question that has an exact mathematical answer becomes a statistical one: how often is that answer observed?
A compiler changes the experiment by choosing the qubits, their interactions and the native instructions. A reduction in gates is a useful indicator, but the quantity an experimenter eventually cares about is the quality of the measured output. Different circuits with similar counts can behave differently.
Define usability before looking at the results
Suppose an experiment returns a target string with probability p. Independent shots give a binomial estimate of that probability. There are several possible criteria: exceed a predetermined success rate, recover the target as the most frequent string, or exceed the success rate of a specified reference. They are different tests. A uniform random string has probability 2−n of being correct for n bits; exceeding that tiny probability by itself need not make the algorithm useful.
A confidence interval helps distinguish a real difference from sampling variation. The following Wilson interval calculation uses hypothetical shot counts, and can be applied to actual recorded counts.
Illustration: standalone Python calculation.
from math import sqrt
k,n,z = 240,1000,1.96
p=k/n
c=(p+z*z/(2*n))/(1+z*z/n)
h=z*sqrt(p*(1-p)/n+z*z/(4*n*n))/(1+z*z/n)
print(round(c-h,3),round(c+h,3))
assert c-h < p < c+h With 240 target strings in 1,000 shots, the example prints:
0.215 0.267 The interval assumes independent Bernoulli shots. Ranking several strings requires uncertainty in the competing frequencies as well, and repeated interleaved sessions help assess calibration drift and correlated errors.
Compare implementations on equal terms
Choose a set of secret strings with different Hamming weights and a range of circuit widths. For every circuit, compile the same input for the same working coupling graph. Check that the compiled circuit preserves the intended computation and that the measured bit order is interpreted correctly. Use the same measurement procedure and shot budget for the candidate implementations.
Where possible, interleave the jobs rather than running all circuits from one method before the other. Record calibration and execution time. Repeated observations across independent hardware sessions help reveal whether a result is specific to a particular calibration. Include a simple reference circuit, such as an identity preparation and measurement, to help interpret readout behavior.
What the result would tell us
Plot success probability, with intervals, against width or two-qubit gate count. Mark the chosen usability criterion before examining the curve. If an implementation remains above that criterion at a larger width, the experiment has measured a concrete benefit for this circuit family and hardware setting. The compilation counts then help explain that observation. This is a more useful evaluation than treating a gate-count reduction as a direct measurement of hardware success.
Use the 4colors Quantum Compiler to prepare candidate implementations for a controlled hardware experiment.