Papers
Topics
Authors
Recent
Search
2000 character limit reached

Statevector Test: Deterministic Quantum Verification

Updated 7 July 2026
  • Statevector Test is a quantum-centric method that deterministically verifies circuit outputs by comparing the complete simulated statevector to a known expected state.
  • It uses classical simulation with a stringent numerical tolerance of 1×10⁻¹⁰ to ensure precise matching of amplitudes and phase relationships.
  • The approach is ideal for small, measurement-free circuits, outperforming statistical tests with perfect accuracy in detecting faulty quantum states.

Statevector Test is a quantum-centric unit test oracle for quantum circuits that checks whether a circuit produces an expected pure quantum state by comparing the circuit’s simulated final statevector against a known expected statevector. In the formulation studied in quantum software engineering, it runs only on a classical computer, assumes that the expected state is known, and functions as a deterministic test for small, measurement-free circuits because it compares the full internal quantum state—including amplitudes and phase relationships—rather than sampled output distributions (Miranskyy et al., 23 Jul 2025).

1. Formal definition

The test is defined for an input preparation WW, a program under test UU, and an expected output statevector ψE\ket{\psi_E}. The initial register is

ψ0=0n,\ket{\psi_0}=\ket{0}^{\otimes n},

the prepared input state is

ψI=Wψ0,\ket{\psi_I}=W\ket{\psi_0},

and the actual state produced by the circuit under test is

ψA=UψI.\ket{\psi_A}=U\ket{\psi_I}.

The correctness condition is stated as

ψAψE.\ket{\psi_A}\approx\ket{\psi_E}.

The test passes if and only if the simulated actual state matches the expected one within numerical tolerance (Miranskyy et al., 23 Jul 2025).

This formulation makes the oracle explicitly state-based rather than distribution-based. The compared object is not a histogram of measurement outcomes and not an overlap estimate derived from repeated shots. It is the full pure-state representation. The paper therefore presents the method as a high-precision, deterministic unit test for quantum circuits, with the further qualification that it is applicable only when the expected state ψE\ket{\psi_E} is known and when statevector simulation is feasible (Miranskyy et al., 23 Jul 2025).

2. Execution model and assumptions

The Statevector Test follows an arrange–act–assert structure. The paper gives the algorithm in the following form:

ψI=Wψ0,\ket{\psi_I}=W\ket{\psi_0},3

The output is binary: Pass if UU behaves as expected for the chosen input, and Fail otherwise (Miranskyy et al., 23 Jul 2025).

The method assumes four conditions. First, the expected state ψE\ket{\psi_E} is known. Second, the circuit is unitary and can be simulated without measurements in the middle of the state evolution used for comparison. Third, the circuit is small enough that statevector simulation is feasible. Fourth, the comparison is done in a simulator with high numerical precision. The paper is explicit that if the expected output is unknown, then “one cannot perform a meaningful test” (Miranskyy et al., 23 Jul 2025).

The implementation discussed in the study is purely classical. The paper states that the test “runs only on a classical computer” and “does not require any quantum execution or simulation, i.e., it can be computed purely through classical matrix multiplications.” It also names Qiskit explicitly through the example Statevector.from_instruction(circuit) (Miranskyy et al., 23 Jul 2025). The reason is structural rather than incidental: quantum hardware does not expose the full statevector, whereas the test depends on direct access to all amplitudes.

3. Comparison semantics and numerical criterion

The compared object is the complete statevector of the quantum circuit. The paper defines the expected state as “a complete theoretical description of the quantum state that the circuit is intended to produce. It is represented as a state vector containing all the amplitudes (with both magnitude and phase) for every basis state” (Miranskyy et al., 23 Jul 2025).

This implies that the test checks more than output probabilities. It checks magnitude, relative phase, and coherence structure across the full basis. That is why the paper characterizes it as stronger than statistical comparison of output distributions: it verifies “not only correct output probabilities but also accurate coherence and phase relationships” (Miranskyy et al., 23 Jul 2025).

Equality is approximate rather than exact:

UU0

The approximation is purely numerical. The implementation tolerance used in the study was

UU1

which the paper notes is tighter than both NumPy np.allclose and Qiskit equiv, each at UU2 (Miranskyy et al., 23 Jul 2025). Within that tolerance, the paper reports neither false positives nor false negatives for the Statevector Test.

The paper also gives a theoretical rationale, but explicitly as a conjectural one. It says the method is rooted in the trace distance between quantum states,

UU3

with pure states represented by

UU4

This trace-distance expression is not the implemented decision rule; the implemented rule remains direct statevector comparison (Miranskyy et al., 23 Jul 2025).

An important technical limitation is that global-phase handling is not formally specified. The paper states only that vectors are compared as UU5. It mentions Qiskit’s equiv in a tolerance footnote, but it does not give an explicit phase-invariant criterion such as maximization over UU6. The safe interpretation is therefore that the comparison is on the statevector itself, with numerical tolerance, but with global-phase normalization left under-specified (Miranskyy et al., 23 Jul 2025).

4. Reliability and empirical behavior

The paper presents the Statevector Test as the most reliable method among the tested approaches because it compares the exact simulated state rather than an empirical estimate derived from finite samples. In its theoretical comparison table, the Statevector Test “Can produce false positives? No” and “Can produce false negatives? No,” with the practical qualification “within numerical tolerance” (Miranskyy et al., 23 Jul 2025).

A small motivational experiment reports identical performance at both UU7 and UU8 shots, precisely because the method is shot-independent. The reported values are TP UU9, TN ψE\ket{\psi_E}0, FP ψE\ket{\psi_E}1, FN ψE\ket{\psi_E}2, Accuracy ψE\ket{\psi_E}3, Precision ψE\ket{\psi_E}4, Recall ψE\ket{\psi_E}5, and ψE\ket{\psi_E}6 (Miranskyy et al., 23 Jul 2025).

The main empirical study evaluates tests on 1,796,880 mutated quantum circuits, divided into 1,751,850 mutated circuits in the Random Circuits dataset and 45,030 mutated circuits in MQT Bench, all on circuits with up to 5 qubits (Miranskyy et al., 23 Jul 2025). For the Statevector Test, the comparison is “done once per pair,” because no repeated measurement shots are required.

For faulty-state detection, the paper reports perfect recall on both datasets. In the TP/FN table, the Random Circuits dataset gives TP ψE\ket{\psi_E}7, FN ψE\ket{\psi_E}8, Recall ψE\ket{\psi_E}9, and the MQT Bench dataset gives TP ψ0=0n,\ket{\psi_0}=\ket{0}^{\otimes n},0, FN ψ0=0n,\ket{\psi_0}=\ket{0}^{\otimes n},1, Recall ψ0=0n,\ket{\psi_0}=\ket{0}^{\otimes n},2 (Miranskyy et al., 23 Jul 2025). The paper summarizes the result as follows: “the Statevector test successfully detected all faulty states in the faulty circuits considered.”

The relative position of the method against the other tested families is summarized by the recall values reported in the study:

Test Random Circuits recall MQT Bench recall
Statevector 1.000 1.000
Swap 0.824 0.958
Inverse 0.904 0.975

These numbers establish the empirical hierarchy described in the paper: when classical simulation is feasible, the Statevector Test is the strongest oracle; when hardware execution is required, the Inverse test is the strongest practical alternative among the methods considered (Miranskyy et al., 23 Jul 2025).

5. Scalability and limitations

The decisive limitation of the Statevector Test is that it inherits the complexity of full statevector simulation. The paper states that the statevector has size

ψ0=0n,\ket{\psi_0}=\ket{0}^{\otimes n},3

and gives the complexity summary: circuit width ψ0=0n,\ket{\psi_0}=\ket{0}^{\otimes n},4, shot count ψ0=0n,\ket{\psi_0}=\ket{0}^{\otimes n},5, classical computer prep time ψ0=0n,\ket{\psi_0}=\ket{0}^{\otimes n},6, classical simulator time ψ0=0n,\ket{\psi_0}=\ket{0}^{\otimes n},7, and quantum computer time ψ0=0n,\ket{\psi_0}=\ket{0}^{\otimes n},8 (Miranskyy et al., 23 Jul 2025). The study therefore capped experiments to circuits with at most 5 qubits to conserve resources.

This constraint is not peculiar to the testing framework; it is the standard full-state scaling barrier. In simulator work on Qibo, full statevector simulation is still treated as the exact, unrestricted baseline for arbitrary circuits of moderate size, but the motivation for going beyond it is that “the memory required to fully represent a qubit system explodes exponentially as the number of qubits increases.” In that framework, the installed default NumPy backend is intended for relatively small circuits, with the rough practical regime

ψ0=0n,\ket{\psi_0}=\ket{0}^{\otimes n},9

(Pasquale et al., 2024). The Statevector Test operates inside precisely this regime of exact full-state accessibility.

Beyond exponential scaling, the paper identifies four additional limitations. First, it is classical-only and cannot run on actual quantum hardware. Second, it requires a known expected state ψI=Wψ0,\ket{\psi_I}=W\ket{\psi_0},0. Third, the compared quantum portion must remain measurement-free, because the scripts used in the study remove measurements before computing a circuit’s statevector. Fourth, the equality criterion depends on numerical tolerance and leaves global-phase treatment unspecified (Miranskyy et al., 23 Jul 2025).

These limitations shape the paper’s practical guidance. The Statevector Test is best suited to small, simulator-friendly unit tests, and especially to subroutines or small representative instances of scalable circuit generators. For larger circuits or hardware-only testing, the paper recommends switching to other test families rather than extending statevector comparison beyond its feasible range (Miranskyy et al., 23 Jul 2025).

6. Relation to other “state” and overlap tests

The Statevector Test is distinct from hardware overlap-estimation protocols. A photonic swap-test implementation, for example, estimates

ψI=Wψ0,\ket{\psi_I}=W\ket{\psi_0},1

from ancilla statistics. That quantity is the squared overlap or pure-state fidelity, but it does not reconstruct the full statevector and does not return the complex inner product itself (Baldazzi et al., 2024). By contrast, the Statevector Test compares the complete simulated amplitude vector against an expected amplitude vector.

It is also distinct from the quantum state identity problem. In that setting, the task is to decide whether ψI=Wψ0,\ket{\psi_I}=W\ket{\psi_0},2 unknown pure states are identical or unequal under the promise that all states are either pairwise orthogonal or identical. The optimal one-sided test is the permutation test, and for two input states this reduces to the Swap test (Buhrman et al., 2024). This is a symmetry-testing problem over unknown inputs, not a unit-testing oracle over a known expected output statevector.

A further possible confusion arises from foundational experiments that test the ontological status of the wavefunction. The trapped-ion realization of the Pusey–Barrett–Rudolph state-overlap test asks whether distinct pure quantum states can correspond to the same underlying physical state (Nigg et al., 2012). That foundational use of “state test” is conceptually unrelated to the Statevector Test in quantum software engineering.

In the software-engineering sense, then, Statevector Test has a precise and narrow meaning: it is a deterministic, classical, full-state oracle for verifying that a quantum circuit prepares the expected pure state when exact statevector simulation remains computationally feasible (Miranskyy et al., 23 Jul 2025).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Statevector Test.