TRANSMISSION // 2612.02079v1
Quantum Debugging Gets Two Kinds of Assertions
Source published
QDB3 adds simulator-only checks of quantum-state amplitudes to sampling-based tests. Teaching examples show how the methods can catch different circuit errors, alongside limits on scale and use.

A quantum program’s behavior can be hard to inspect: measurement changes a state, while simulation can expose more detail but grows costly as circuits grow. QDB3, a Python assertion library for NVIDIA CUDA-Q, combines checks based on measurement samples with checks of simulated state vectors. The authors illustrate how each can help test a circuit—and where the approach does not yet reach.
Debugging a quantum circuit is not as simple as pausing a classical program and looking at its internal state. A quantum system can occupy a superposition of many possibilities, and measurement produces an outcome while changing the state. That makes it difficult to check what a circuit is doing at intermediate steps.
In “Quantum Debugging in Action: Statistical and State Vector Assertions,” Coco Gong, Rena Feng, Era Thaqi and Margaret Martonosi present QDB3, a Python assertion library implemented in NVIDIA’s CUDA-Q. An assertion is a check placed in a program to test whether a condition holds. QDB3 offers two kinds of checks: one examines patterns in measurement samples; the other uses the state vector available in simulation.
Two ways to check a circuit
A statistical assertion uses measurement shots to collect outcomes and tests whether their distribution is consistent with a desired property. Because it relies on sampling, its verdict is probabilistic. The authors describe this approach as flexible and applicable to hardware deployment.
A state-vector assertion instead examines simulated amplitudes directly. These amplitudes determine measurement probabilities and encode phase relationships that may not be apparent from measurement samples. QDB3 uses them to check properties such as whether a register is in a particular classical state, whether its outcomes are uniformly distributed, or whether parts of a system are separable rather than entangled.
This access has trade-offs. State-vector checks are mathematically exact within the simulation and can examine successive checkpoints during one simulation pass, rather than requiring fresh shots at each checkpoint. But the state vector grows exponentially with the number of qubits, creating a scaling limitation; the paper does not benchmark a particular resource cutoff. The checks are also simulator-only: they do not inspect amplitudes on quantum hardware.
What the examples show
The paper illustrates the two methods with teaching examples, including a Bernstein–Vazirani circuit and a Quantum Approximate Optimization Algorithm (QAOA) circuit. In the Bernstein–Vazirani example, a controlled-Z gate is used where a controlled-X gate was intended. The authors report that a statistical check for separability passes despite the bug, while a state-vector check detects the unintended entanglement.
In the QAOA example, the authors check for entanglement after a cost layer. The operations in that layer are diagonal in the computational basis, and the paper explains that the resulting entanglement is invisible to a product check based on sampling in that basis. In the example, the statistical check fails to detect the property, while a state-vector assertion does. This illustrates why the choice of check matters: distributional tests and direct inspection of simulated state structure can reveal different things.
The authors propose a workflow that begins with state-vector assertions during early simulator-based debugging, then uses statistical assertions as circuits grow or move toward hardware. Their examples demonstrate how the two approaches can complement each other; they do not establish that QDB3 improves debugging performance across a broad set of real-world programs.
Limits and context
The paper presents teaching examples rather than a large-scale evaluation across many circuits or hardware devices. It does not report a broad benchmark of how often the assertions catch bugs in practice. In the examples, statistical checks can miss properties that state-vector checks identify, but the paper does not establish sampling variability as the cause of the Bernstein–Vazirani result.
The paper also notes that neither static nor dynamic CUDA-Q kernels cleanly support mid-circuit assertions under the compilation methods discussed, pointing to a need for closer coordination between assertion tools and the platform.
QDB3 extends earlier work on statistical assertions with simulator-only state-vector checks. The contribution presented here is primarily an implementation and demonstration, not evidence that the underlying measurement limits of quantum debugging have been overcome. The source is an arXiv preprint; this account does not establish whether it has undergone peer review. Its findings should therefore be read as a focused tool description and set of examples, not as a comprehensive assessment of quantum debugging methods.
- quantum computing
- quantum debugging
- CUDA-Q
- software assertions
- quantum simulation
- state vector
Related reading
Automatically matched by shared topic keywords. These links do not imply that the sources agree or establish a consensus.
Cqlib aims to connect quantum programs from code to hardware
Source published
Shared keywords: quantum computing, quantum simulation
A faster classical simulator for fermionic quantum circuits
Source published
Shared keywords: quantum simulation
When AI Translates Quantum Code, Correctness Is More Than Syntax
Source published
Shared keywords: quantum computing
When a fixed plan can cut the measurement cost of quantum simulations
Source published
Shared keywords: quantum computing, quantum simulation
A low-latency FPGA-to-Spark link for quantum error correction
Source published
Shared keywords: quantum computing