Random SWAP Tests in Quantum State Analysis
- Random SWAP Tests are randomized protocols that leverage ancilla-mediated SWAP operations to assess quantum state identity and purity.
- They employ strategies like random pairing, permutation tests, and coherent routing to approximate global symmetrization and perform Schur sampling and state purification.
- Hardware-native implementations and statistical analyses show that these tests optimize gate usage and improve sample efficiency in quantum experiments.
Random SWAP Tests are randomized protocols built from the SWAP test, the ancilla-mediated measurement of exchange symmetry that, for two pure inputs and , accepts with probability , and for mixed inputs with probability . In the literature considered here, the expression does not denote a single universal circuit; rather, it covers several families of randomized uses of the SWAP primitive, including random permutations followed by trees of pairwise SWAP tests for quantum state identity, uniformly random pairwise singlet detection for Schur sampling and purification, coherent random-pair selection among many states, and repeated hardware-native fidelity tests over randomly prepared inputs or random single-qubit rotations (Buhrman et al., 2024, Brahmachari et al., 7 Aug 2025, Li et al., 2021).
1. Exchange-symmetry measurement as the common primitive
At the two-qubit level, the SWAP operator exchanges two systems, and the corresponding symmetric and antisymmetric projectors are
For qubits, is the singlet projector , where . A standard ancilla-based SWAP test therefore implements a two-outcome measurement of exchange symmetry, with outcome statistics determined by 0. In the pure-state case this reduces to the squared overlap; in the mixed-state case it measures Hilbert–Schmidt overlap (Brahmachari et al., 7 Aug 2025).
Randomization enters only through how this primitive is deployed. One axis of randomization is over the tested systems: one may select pairs uniformly at random from a larger register set, permute the input order before pairwise testing, or repeatedly draw random input states. A second axis is over circuit context: the SWAP test may appear inside subgroup-averaged identity tests, balanced binary trees, Schur-sampling procedures, or random-circuit purity measurements. A third axis is over control layers: some proposals use random single-qubit rotations before the SWAP test, while others rely on stochastic physical noise and study how this affects the symmetry measurement. Across these variants, the invariant structural feature is that information is extracted through projections onto symmetric versus antisymmetric sectors.
2. Permutation-based randomization and quantum state identity
The most developed randomized SWAP-test framework arises in quantum state identity (QSI), where 1 unknown states are promised to be either all identical or pairwise orthogonal. For 2, the optimal one-sided protocol is exactly the SWAP test. For general 3, the natural extension is the permutation test over 4, whose acceptance operator is the projector onto the symmetric subspace,
5
This test has perfect completeness, and for the fine-grained promise class 6 its soundness at prior 7 is 8. The same work shows, via a semidefinite program, that in the two-sided regime the permutation test remains optimal whenever the equal-input prior satisfies 9; if 0, the optimal strategy is the trivial rule that always outputs “not equal.” Thus relaxing one-sided error does not improve the achievable average success beyond the permutation test in the nontrivial prior regime (Buhrman et al., 2024).
Randomized SWAP-test strategies appear as resource-conscious approximations to this global symmetrization. The paper introduces 1-tests, where one averages over a subgroup 2, and analyzes their soundness through the multiplicities 3 of the trivial irrep inside restricted 4 irreps. The cyclic “circle test” is a prominent example: for prime 5, it matches the permutation test’s worst-case soundness while requiring only a quantum Fourier transform over 6, rather than over 7.
The most explicit randomized construction is the Iterated Swap Tree (IST). For 8, one first samples a uniformly random permutation 9, relabels the inputs, and then performs 0 SWAP tests arranged in a balanced binary tree. If any SWAP test outputs 1, the protocol rejects; otherwise it accepts. The scheme has perfect completeness, and for the two-block promise 2 its soundness satisfies
3
where 4 is defined recursively in the paper. For 5, the bound is exact and optimal: 6 The role of the initial random permutation is essential: without it, orthogonal labels can be placed pathologically so that many layers compare equal sub-blocks and fail to detect inequality.
3. Random pairwise singlet detection, Schur sampling, and purification
A distinct meaning of Random SWAP Tests is developed for permutation-invariant (PI) 7-qubit states. Here the protocol repeatedly chooses a uniformly random pair from the currently active qubits and performs the two-outcome measurement 8, interpreted as singlet detection. Detected singlet pairs are removed from the active pool, while a classical register updates the running estimate 9, where 0 is the number of extracted singlets. The remaining qubits 1 and isolated singlets 2 together encode the same PI information as the input, and the process is lossless for PI data after forgetting the register and re-permuting (Brahmachari et al., 7 Aug 2025).
This random pairwise procedure reproduces weak Schur sampling and unitary Schur sampling. If the true Schur sector is labeled by 3, then once 4 singlets have been found, no further singlets can be detected and the residual active state is exactly the encoded irrep state 5. The conditional probability that the next random SWAP test detects a new singlet is
6
From this, the expected number of tests needed to find all singlets in sector 7 obeys
8
The paper identifies a sharp threshold: after approximately 9 random SWAP tests, the probability of detecting any new singlet decays exponentially in 0.
The resulting approximation to the Schur transform is quantitative. For any PI input 1,
2
Hence trace-distance error 3 is guaranteed once
4
This is the central theorem behind the interpretation of random SWAP tests as a measurement-only route to Schur sampling.
The same machinery yields optimal qubit purification for depolarized copies
5
The Schur transform achieves the optimal single-qubit fidelity
6
and the random-SWAP protocol approaches it exponentially fast: 7 The paper also contrasts this with a prior sequential SWAP-based purification method and states that the random protocol attains the Schur-optimal limit with substantially better sample and gate complexity in the strong-noise regime.
4. Coherent random-pair selection among many input states
Another line of work generalizes the SWAP test from two inputs to an arbitrary number 8 of unknown pure states. The core object is a recursive pairing unitary 9 that uses 0 controlled-SWAP gates and 1 ancilla qubits to create a superposition in which every unordered pair of the 2 inputs is routed into the first two data registers and labeled by an ancilla basis state. For 3, the explicit recurrences are
4
so that
5
For arbitrary 6, the divide-and-conquer recurrences remain 7 and 8 (Gitiaux et al., 2021).
Once the coherent routing has been performed, a single ordinary SWAP test on the top two registers yields a random pair label and its overlap statistic in one shot. Conditioning on the ancilla label 9 associated with pair 0, the control-qubit outcomes obey
1
Thus the standard two-state SWAP-test relation is recovered after coherent pair selection. The same conditional formula extends to mixed inputs by replacing 2 with 3.
This construction gives a circuit-theoretic meaning to random SWAP tests over many candidate states. Rather than classically choosing a pair and running a separate circuit for each choice, one performs coherent routing once and samples pair labels by measurement. The paper states an 4-sample-complexity upper bound 5 for estimating the full vector of pairwise overlaps, and a matching lower bound showing that keeping the ancilla-label size at 6 is necessary for polynomial sample complexity.
5. Hardware-native, interferometric, and process-characterization realizations
In semiconductor double quantum dots (DQDs), a hardware-native SWAP-test implementation was proposed using a charge qubit encoded in electron position and a tunable three-qubit Hamiltonian
7
The key ingredient is a Toffoli-like gate natural to this architecture. Three such gates are cascaded into an “imperfect” controlled-SWAP 8, and a final correction stage with one additional Toffoli-like gate recovers the desired SWAP-test statistic. The full protocol uses four three-qubit gates and four single-qubit rotations arranged in six layers, with 9, 0, and total runtime 1, below the reported 2 coherence scale. Because of the sign structure of the hardware-native 3 gate, the fidelity is not extracted from the usual 4 formula; instead the ancilla statistics yield
5
The same paper explicitly notes that repeated randomized runs are compatible with this platform: random input states or random single-qubit rotations can be applied in tens of picoseconds before the six-layer SWAP-test circuit, enabling randomized sampling over many shots (Li et al., 2021).
A different realization appears in swap-test interferometry, where the balanced beam splitters of a Mach–Zehnder interferometer are replaced by two SWAP tests, one before and one after a phase shift. For Fock-state inputs this projects onto NOON-like states, while for coherent-state inputs it produces entangled coherent states. The analysis emphasizes ancilla noise bias: phase-flip (6) errors commute with controlled-SWAP and primarily reduce visibility by a known factor, whereas bit-flip (7) errors during the gate are harmful and can destroy Heisenberg scaling. The paper does not intentionally randomize ancilla states or circuit elements, but it discusses randomized variants such as random ancilla preparation on the Bloch equator, random phase schedules, and random placement or number of controlled-SWAP layers, all under the condition that 8-bias dominate 9-errors (Černotík et al., 2021).
Swap-test-based process characterization on universal quantum computers provides a more diagnostic perspective. In that setting, standard CSWAP and Bell-state-measurement variants are shown to be insufficient for uniquely diagnosing mixed-state decoherence because of degeneracies across Bloch-sphere directions. The proposed remedy is a Toffoli-based swap test supplemented by a control-basis measurement and classical OR post-processing,
0
with analytically derived curves such as
1
The paper does not implement random SWAP tests, but it notes that randomization over probe angles would naturally follow from these expressions; for example, uniformly averaging 2 would force 3 independently of 4, while targeted deterministic choices maximize sensitivity to decoherence (Ripper et al., 2022).
6. Statistical efficiency, random-circuit settings, and conceptual boundaries
Randomization does not eliminate the fundamental statistical limitations of pairwise SWAP testing. For repeated SWAP tests on 5 independent pairs with squared overlap 6, the natural unbiased estimator 7 has variance
8
By contrast, the optimal collective measurement on 9 copies of one state and 00 copies of the other achieves asymptotic local mean-square error
01
and the paper shows that random pairing and random local pre-processing do not alter the small-02 inefficiency of swap-test statistics. This becomes especially severe in large dimension, where Haar-random overlaps concentrate near 03. A related disturbance comparison is also unfavorable to repeated SWAP tests: their average post-measurement fidelity is
04
whereas the optimal collective measurement has
05
and is less invasive across the parameter range analyzed (Fanizza et al., 2019).
A separate but related setting concerns SWAP measurements after local random quantum circuits. There the object of study is not overlap between two unknown inputs but the purity of a subsystem after random circuit evolution. The SWAP observable 06 on two copies is propagated by an ensemble completely positive map 07, yielding average purity
08
and corresponding ancilla-0 probability
09
The formalism of swap algebras reduces this dynamics to a closed action on permutation operators 10, giving short-time area-law bounds, exact one-dimensional solutions, and asymptotic purity formulas for connected graphs. In this usage, randomness comes from the circuit ensemble rather than from the selection of tested inputs, but the measured quantity is still a SWAP expectation value on two copies (Zanardi, 2013).
Taken together, these results delimit the concept of Random SWAP Tests. Randomization can approximate permutation symmetrization, isolate singlets needed for Schur sampling, expose many pairwise overlaps with only logarithmic ancilla overhead, or adapt SWAP-based fidelity estimation to concrete hardware. It can also distribute orthogonal labels more favorably, preserve permutation-invariant information, and reduce circuit engineering demands. What it does not do, by itself, is promote the pairwise SWAP test to the collectively optimal estimator of overlap in regimes where small overlaps dominate.