REVIEW 4 major objections 4 minor 1 cited by
Statistical Assertions for Debugging Quantum Circuits and States in CUDA-Q
T0 review · 4 major / 4 minor · reviewed 2026-08-06 · deepseek-v4-flash
Pith's one-line read This paper claims that replacing chi-square with Fisher's exact test and Monte Carlo simulation makes statistical product state assertions reliable for CUDA-Q debugging.
desk verdict A useful CUDA-Q debugging port with a real but fixable soundness gap in the product state assertion and a likely error about SciPy's fisher_exact. read the letter →
The pith
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
The reading
What carries the argument
The load-bearing object is the observed contingency table of measurement counts for the two qubit groups under test, combined with Fisher's exact test (for 2x2 tables) or the Monte Carlo method (for larger tables). These tests compute a p-value under the null hypothesis that the two groups are statistically independent; a large p-value is taken to mean the qubits are in a product state. The workflow also depends on CUDA-Q's dynamic kernels, which permit classical Python functions to be called mid-circuit, enabling the assertions to sample the current state.
What would settle it
Prepare the two-qubit entangled state (|0+> + |1->)/√2, run the product state assertion on it, and check whether the assertion reports a product state despite the state being entangled.
Extended reading notes
Core claim
The authors claim that a contingency table built from sampled computational-basis outcomes, passed through scipy.stats.fisher_exact, yields accurate p-values for product state assertions across circuits where the previous chi-square-based approach fails. For 2x2 tables the method uses Fisher's exact test; for larger tables it uses Monte Carlo simulation with 9999 generated tables, both of which handle zero counts without the division-by-zero problem that plagues the chi-square statistic. They also claim that dynamic kernels in CUDA-Q, wrapped in a custom StatKernel class, allow these statistical assertions to be inserted at arbitrary points in a circuit, and that static kernel examples must be translated to dynamic kernels to use the tool.
Load-bearing premise
The product state assertion relies on the premise that statistically independent measurement outcomes mean the qubits are not entangled, a premise that fails for some entangled states.
Editorial extensions
If this is right
- CUDA-Q developers can insert classical, uniform, and product state assertions at arbitrary points in dynamically constructed kernels, sampling the current state with cudaq.sample.
- The product state assertion using Fisher's exact test and Monte Carlo simulation returns a p-value of 1 for a two-qubit register after an X gate, where a previous chi-square-based assertion incorrectly reported entanglement.
- A shot count of 1000 can yield incorrect results for product and uniform state assertions due to p-value fluctuations, while 10,000 shots remediate the issue; the classical assertion remains accurate at 500 shots.
- Support for static CUDA-Q kernels remains open, since user-defined classical Python functions cannot currently be called inside them.
Reading between the lines
- Because the assertion equates statistical independence of computational-basis outcomes with being a product state, it cannot certify the absence of entanglement; a state such as (|0+> + |1->)/√2 would likely be misreported as a product state.
- A more robust product state check would sample in multiple measurement bases or use an entanglement witness, an extension the current framework does not implement.
- The dynamic-kernel requirement means existing static-kernel CUDA-Q programs must be rewritten to use the tool, so a translation or injection mechanism for static kernels would substantially widen applicability.
Signed reviews
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. The paper presents a debugging workflow for CUDA-Q based on statistical assertions. It implements three assertions—classical, uniform, and product state—by inserting calls into dynamically constructed CUDA-Q kernels, sampling the circuit with cudaq.sample, and applying statistical tests. The claimed contribution is twofold: (i) it ports prior Qiskit-based statistical assertions to CUDA-Q and adapts them to CUDA-Q's kernel-based programming model, and (ii) it replaces the chi-square test in the product state assertion with a combination of Fisher's exact test and a Monte Carlo method, which the authors argue is more reliable for sparse measurement distributions. The workflow is demonstrated on the Bernstein-Vazirani algorithm and the Quantum Fourier Transform, with qualitative debugging examples.
Significance. If the claims were sound, the tool would fill a real usability gap in CUDA-Q by providing mid-circuit statistical checks. The statistical-test improvement (Fisher/Monte Carlo over chi-square for sparse tables) is a reasonable incremental idea, and the careful discussion of CUDA-Q's dynamic-kernel constraints is useful for the quantum-software community. However, the central claim about the product state assertion is logically flawed: the assertion tests only statistical independence of computational-basis measurement outcomes, which is not equivalent to a product state. The paper does not acknowledge this limitation, and the presented counterexample shows the assertion can silently accept an entangled state. This undermines the abstract's claim to have improved the 'reliability and accuracy' of the product state assertion.
major comments (4)
- [Section IV-C and IV-C1] The product state assertion's semantic foundation is unsound. The null hypothesis is statistical independence of computational-basis measurement outcomes, and the paper equates acceptance of this null with 'likely in a product state.' But independence of computational-basis marginals is necessary, not sufficient, for a product state. A concrete counterexample is the entangled state (|0+> + |1->)/√2, whose measurement probabilities in the computational basis are exactly P(00)=P(01)=P(10)=P(11)=1/4. This distribution is perfectly independent, so Fisher's exact test (or Monte Carlo) will return a large p-value and the assertion will report a product state, even though the state has Schmidt rank 2 and is entangled. This is not a finite-shot artifact; the exact distribution is independent. Consequently, the assertion cannot serve the stated debugging purpose of detecting whether qubit groups are entangled, and the claim in the abstract that the product state assertion's 'reliability and accuracy' are improved is not supported. The paper must either reframe the assertion as a test of basis-specific independence with an explicit statement that it is only a necessary condition for a product state, or replace it with a test that can actually certify productness (e.g., using purity or an entanglement witness).
- [Section IV-C1 and IV-C2] The description of scipy.stats.fisher_exact is factually incorrect. SciPy's fisher_exact function only supports 2x2 contingency tables; it does not automatically invoke a Monte Carlo method for larger tables. The Monte Carlo approach for general contingency tables is available through scipy.stats.chi2_contingency with an appropriate method parameter, or through other Monte Carlo routines. As written, the sentence 'we call scipy.stats.fisher_exact(cont_table). This method calls Fisher's exact test if the contingency table is of size 2 × 2, or else it calls the Monte Carlo Method' is wrong and would lead to a runtime error for non-2x2 tables. This undermines the reproducibility of the implementation and the claim that 'extensive testing ... using scipy.stats.fisher_exact' was performed. The authors should specify the actual functions and parameters used, and correct the text accordingly.
- [Section IV-C2] The argument against the chi-square test contains a technical error. The paper states that zeros in the observed contingency table cause zeros in the expected contingency table (because row and column sums are 'likely zero'), leading to an undefined chi-square statistic. However, the expected count is E_ij = R_i * C_j / N, which is zero only when the entire row or column marginal is zero, not when an individual cell is zero. A sparse table with a zero cell but positive row and column margins still has a positive expected count for that cell. The legitimate concern is that the chi-square approximation is unreliable when expected counts are small, not that the statistic is undefined for zero cells. This reasoning flaw weakens the motivation for replacing chi-square and should be corrected.
- [Section V-A] The mechanism for 'mid-circuit' sampling is not convincingly described. The paper says the assertion methods 'first sample the current quantum state for a specified number of shots using cudaq.sample to construct a measurement distribution, then run the appropriate statistical test,' and that 'after the assertion is executed, programmers can continue building the circuit as normal, without explicitly rebuilding the quantum state.' In CUDA-Q, cudaq.sample executes a kernel from start to finish and returns measurement outcomes; it does not sample an intermediate state of a partially constructed kernel. The authors do not explain how the intermediate state is extracted or how the circuit continuation is achieved without rebuilding the state. If the tool works by executing a truncated copy of the kernel, that must be stated explicitly; otherwise, the described workflow is not implementable in CUDA-Q as written.
minor comments (4)
- [Section IV-C4] The statement about the teleportation circuit is confusing: it says a product state assertion should be placed because we expect the qubits to be entangled, and that the assertion should 'return false.' Since the assertion is named after the product state, the relationship between 'false' and 'entangled' should be stated more explicitly to avoid implying the assertion detects the desired state directly.
- [Section VIII] The observation that 1000 shots 'occasionally led to incorrect results' while 10,000 shots fixed the issue is anecdotal. To support this claim, the authors should report quantitative failure rates, the circuits used, and the statistical significance of the improvement.
- [References] Reference [9] is a Medium blog post that may not be stable or citable as a primary source; consider replacing it with a standard quantum-information textbook. Similarly, reference [12] on Monte Carlo simulation is a general IBM page; a statistics textbook or the SciPy documentation for chi2_contingency would be more appropriate.
- [General] The paper frequently uses 'likely' and 'probably' when interpreting p-values (e.g., 'likely entangled'). Given the counterexample in the major comments, such language overstates the conclusions. Please tighten the interpretation to match what statistical independence actually implies.
Circularity Check
No circularity found: the statistical assertion workflow is self-contained and validated against external theoretical expectations.
full rationale
The paper's derivation chain is self-contained. The product state assertion constructs a contingency table from measured outcomes, passes it into scipy.stats.fisher_exact, and interprets the p-value under the null hypothesis of statistical independence. No parameter is fitted to the data and then renamed as a prediction; the test statistic is computed directly from observed counts and compared against a theoretical null. The claimed improvement over the chi-square test is supported by a concrete circuit (a single X gate on |00>) where the old chi-square approach returns a small p-value while Fisher's exact test returns p=1, matching the known product-state expectation. The evaluation uses external oracles: theoretical expectations and known entanglement structures of standard algorithms such as Bernstein-Vazirani and QFT. The self-citation to prior work [2], which shares an author with the present paper, is used as background and as the source of the original assertion definitions, but the central contribution—replacing chi-square with Fisher's exact test and the Monte Carlo method—does not reduce to that citation. It is implemented with standard SciPy functions and tested independently. The concern that statistical independence in the computational basis is not equivalent to separability is a correctness limitation of the assertion's semantic interpretation, not a circularity in the statistical derivation; that issue would belong in a correctness or validity review rather than a circularity analysis. Therefore, no circular step is present and the score is 0.
Assumptions & free parameters
free parameters (2)
- critical p-value threshold =
0.05 (user-configurable)
- shot count =
1000 default; 10,000 recommended for product/uniform assertions
assumptions (3)
- domain assumption Measurement outcomes from cudaq.sample are independent and identically distributed samples from the true distribution of the quantum state.
- standard math Glivenko-Cantelli theorem ensures the empirical distribution converges to the true distribution as shots increase.
- ad hoc to paper Statistical independence in the computational basis is equivalent to a product state.
Cite this review
Pith. "Pith review of Statistical Assertions for Debugging Quantum Circuits and States in CUDA-Q." pith.science (2026). https://pith.science/paper/7XWAPYI2
@misc{pith2026250716255,
author = {Pith},
title = {Pith review of: Statistical Assertions for Debugging Quantum Circuits and States in CUDA-Q},
year = {2026},
howpublished = {\url{https://pith.science/paper/7XWAPYI2}},
note = {Machine review of arXiv:2507.16255}
}
read the original abstract
As quantum computing continues to mature, more developers are designing, coding, and simulating quantum circuits. A challenge exists, however, in debugging quantum circuits, particularly as they scale in size and complexity. Given the lack of effective debugging workflows, developers are forced to manually inspect their circuits and analyze various quantum states, which is error-prone and time-consuming. In this research, we present a statistical assertion-based debugging workflow for CUDA-Q. CUDA-Q has gained popularity due to its ability to leverage GPUs to accelerate quantum circuit simulations; this allows circuits to scale to larger depths and widths, where they can be particularly hard to debug by hand. Inspired by and building from prior Qiskit-based debuggers, our work allows CUDA-Q users to verify quantum program correctness with greater ease. Through the insertion of statistical assertions within a quantum circuit, our tool provides valuable insights into the state of qubits at any point within a circuit, tracks their evolution, and helps detect deviations from expected behavior. Furthermore, we improve the reliability and accuracy of the product state assertion by using a combination of Fisher's exact test and the Monte Carlo Method instead of a chi-square test, and examine the impact of CUDA-Q's distinct kernel-based programming model on the design of our debugging tool. This work offers a practical solution to one of CUDA-Q's usability gaps, paving the way for more reliable and efficient quantum software development.
Figures
Figures from the paper (2 more)
Forward citations
Cited by 1 Pith paper
-
Intelligence-Guided Adaptive Purification for DDoS-Resilient Quantum Networks: A CUDA-Q based Study
IDS-driven adaptive purification in a simulated 8-node quantum repeater chain restores fidelity-qualified entanglement delivery under SSDP-induced degradation (0.098 to 0.344 above-target; oracle 0.335).
Reference graph
Works this paper leans on
-
[1]
CUDA-Q for hybrid quantum-classical computing,
NVIDIA, “CUDA-Q for hybrid quantum-classical computing,” https: //developer.nvidia.com/cuda-q, 2025, (Accessed: April 11, 2025)
work page 2025
-
[2]
Statistical assertions for validating patterns and finding bugs in quantum programs,
Y . Huang and M. Martonosi, “Statistical assertions for validating patterns and finding bugs in quantum programs,” in Proceedings of the 46th International Symposium on Computer Architecture, ser. ISCA ’19. New York, NY , USA: Association for Computing Machinery, 2019, p. 541–553. [Online]. Available: https://doi.org/10.1145/3307650.3322213
arXiv 2019
-
[3]
Qiskit terra: Assertions module,
Y . H. Huang and L. Yeh, “Qiskit terra: Assertions module,” https://github.com/edasgupta/qiskit-terra/tree/master/qiskit/assertions, 2019, (Accessed: April 12, 2025)
work page 2019
-
[4]
NVIDIA, “What is a CUDA-Q kernel?” https://nvidia.github.io/cuda- quantum/latest/using/basics/kernel intro.html, 2025, (Accessed: April 11, 2025)
work page 2025
-
[5]
Running your first CUDA-Q program,
——, “Running your first CUDA-Q program,” https://nvidia.github. io/cuda-quantum/latest/using/basics/run kernel.html, 2025, (Accessed: April 11, 2025)
work page 2025
-
[6]
——, “Quantum teleportation,” https://nvidia.github.io/cuda-quantum/ latest/applications/python/quantum teleportation.html, 2024, (Accessed: April 11, 2025)
work page 2024
-
[7]
The glivenko–cantelli theorem,
A. M. Shaikh, “The glivenko–cantelli theorem,” Online, [Online]. Avail- able: https://home.uchicago.edu/ ∼amshaikh/webfiles/glivenko-cantelli. pdf
-
[8]
The chi-square test: Often used and more often misinterpreted,
T. M. Franke, T. Ho, and C. A. Christie, “The chi-square test: Often used and more often misinterpreted,” American Journal of Evaluation, vol. 33, no. 3, pp. 448–458, 2012. [Online]. Available: https://doi.org/10.1177/1098214011426594
Show all 19 references
-
[9]
Understanding product states and entangled states,
M. B, “Understanding product states and entangled states,” https://medium.com/@mohorb04/understanding-product-states-and- entangled-states-6b3f2b2b45f3, 2023, (Accessed: April 11, 2025)
2023
-
[10]
scipy.stats.fisher exact,
SciPy Community, “scipy.stats.fisher exact,” https://docs.scipy.org/doc/ scipy/reference/generated/scipy.stats.fisher exact.html, 2025, (Accessed: Apr. 13, 2025)
2025
-
[11]
The fisher’s exact test,
E. McClenaghan, “The fisher’s exact test,” https://www. technologynetworks.com/tn/articles/the-fishers-exact-test-385738, 2025, (Accessed: April 11, 2025)
2025
-
[12]
What is monte carlo simulation?
IBM, “What is monte carlo simulation?” https://www.ibm.com/think/ topics/monte-carlo-simulation, 2025, (Accessed: Apr. 26, 2025)
2025
-
[13]
Statistical notes for clinical researchers: Chi-squared test and fisher’s exact test,
H.-Y . Kim, “Statistical notes for clinical researchers: Chi-squared test and fisher’s exact test,” Restorative Dentistry and Endodontics , vol. 42, no. 2, p. 152, 2017. [Online]. Available: http://dx.doi.org/10.5395/rde. 2017.42.2.152
2017 doi
-
[14]
scipy.stats.montecarlomethod,
SciPy Community, “scipy.stats.montecarlomethod,” https://docs.scipy. org/doc/scipy/reference/generated/scipy.stats.MonteCarloMethod.html# scipy.stats.MonteCarloMethod, 2025, (Accessed: Apr. 13, 2025)
2025
-
[15]
Just-in-Time Kernel Creation,
NVIDIA, “Just-in-Time Kernel Creation,” https://nvidia.github.io/cuda- quantum/latest/specification/cudaq/dynamic kernels.html, 2025, (Ac- cessed: April 11, 2025)
2025
-
[16]
CUDA-Q applications,
NVIDIA, “CUDA-Q applications,” https://nvidia.github.io/cuda- quantum/latest/using/applications.html, 2025, (Accessed: April 11, 2025)
2025
-
[17]
Quantum complexity theory,
E. Bernstein and U. Vazirani, “Quantum complexity theory,” SIAM Journal on Computing , vol. 26, no. 5, pp. 1411–1473, 1997. [Online]. Available: https://doi.org/10.1137/S0097539796300921
1997 doi
-
[18]
Bernstein-vazirani algorithm,
NVIDIA, “Bernstein-vazirani algorithm,” https://nvidia.github.io/cuda- quantum/latest/applications/python/bernstein vazirani.html, 2025, (Ac- cessed: April 11, 2025)
2025
-
[19]
Quantum fourier transform,
——, “Quantum fourier transform,” https://nvidia.github.io/cuda- quantum/latest/applications/python/quantum fourier transform.html, 2025, (Accessed: April 11, 2025)
2025
Reviewed August 6, 2026 · model on record in the stance chip above.
Discussion (0). Continue with ORCID to comment.