Skip to main content

qdsr-audit — Quantum Overfitting, Post-Selection & QML Statistical Auditing Library

License: MIT Python 3.10+ Software DOI Paper 1 DOI Paper 2 DOI Paper 3 DOI ORCID

Live Web Demo: https://audit.wallstreetdebug.com · Research Suite: fabien-pierret/dcqe-postselection-ai


Why qdsr-audit?

Quadratic quantum search (Grover / Dürr–Høyer / amplitude amplification), variational Quantum Machine Learning (QML), and selective AI evaluation pipelines share a silent statistical hazard: post-selection overfitting.

  • At a fixed oracle query budget $C$, Grover search probes $M_{\mathrm{quant}}(C) = \lfloor (4C/\pi)^2 \rfloor$ hypotheses. On null heavy-tailed Student-$t_3$ data, it amplifies false in-sample discoveries by $11.76\times$ at $C=1{,}000$ while out-of-sample expectation stays identically $0$ — causing $C$-indexed Bonferroni and classical Gaussian Deflated Sharpe Ratios (DSR) to suffer $53.4%\text{--}100%$ False Positive Rates.
  • Deep variational circuits trigger $2^{-n}$ (local) and $4^{-n}$ (global) barren plateaus and exponential kernel concentration, while noisy two-copy quantum memory loses its exponential advantage above depolarizing threshold $p_{\mathrm{cross}} = 1 - 1/\sqrt{2} \approx 29.29%$.
  • Selective abstention or rejection sampling ($\eta < 1$) opens a detection loophole ($\eta^* = 2/(1+\sqrt{2}) \approx 82.84%$) creating spurious CHSH $> 2$ artifacts in both quantum optics and LLM benchmarks.
  • Any linear post-selection audit score $\sum_k w_k I_k$ has minimax risk $R_{\max} = 1$ against single-mode failure manifolds.

qdsr-audit turns these peer-verifiable theorems (4 CERN Zenodo DOIs) into a lightweight, zero-bloat (numpy + scipy only), strictly classical/unitary Python library and CLI — zero quantum woo.


Installation

pip install qdsr-audit

From source (editable install with dev tools):

git clone https://github.com/fabien-pierret/qdsr-audit.git
cd qdsr-audit
pip install -e ".[dev]"

Quickstart (Python API)

1. Heavy-Tail $\mathrm{Q\text{-}DSR}_\nu$ & Quantum Overfitting Audit (Paper 1)

from qdsr_audit import compute_qdsr_audit, simulate_grover_search

# Audit a 4-year daily strategy (Sharpe = 3.2, T = 1,000) found via C = 1,000 Grover queries on Student-t_3 data
res = compute_qdsr_audit(
    sharpe_observed=3.2,
    query_budget_c=1000,
    sample_size_t=1000,
    search_mode="quantum_grover",
    tail_regime="student_t",
    student_nu=3.0,
)
print(res.verdict_code)           # POST_SELECTION_MIRAGE
print(f"Exact Q-DSR_nu: {res.qdsr_exact:.4f} (FWER p = {res.p_value_fwer_exact:.4f})")
print(f"Naive DSR(C):   {res.naive_dsr_c:.4f} (False green light: {res.false_green_light_trap})")
print(f"Amplification:  {res.amplification_ratio_at_c:.2f}x")

# Run an exact 10-qubit (M = 1,024) unitary statevector Grover overfitting check
grover = simulate_grover_search(q_qubits=10, tail_regime="student_t", student_nu=3.0, seed=42)
print(f"Unitarity err: {grover.unitarity_norm_err:.2e}, P_succ: {grover.p_succ_exact:.6f}")

2. Minimax $\mathrm{SIPS}_\infty$, Manski–Rosenbaum Bounds & Welch–MIA Duality (Paper 3)

from qdsr_audit import compute_sips_audit, compute_welch_mia_duality

# Single-mode multiplicity failure: linear average = 0.235 (FALSE PASS), SIPS_infty = 0.85 (VETO)
sips = compute_sips_audit(i_mul=0.85, i_ood=0.04, i_inv=0.03, i_col=0.02)
print(sips.verdict_code, "| linear blindness exposed:", sips.linear_blindness_exposed)

# Welch-bound neural superposition <-> white-box MIA privacy duality (V_AI^2 + D_MIA^2 <= 1)
mia = compute_welch_mia_duality(bottleneck_dim_d=16, num_features_m=64)
print(f"rho={mia.rho:.1f} -> D_MIA={mia.d_mia_whitebox_opt:.3f}, V_AI^2+D_MIA^2={mia.duality_sum:.3f} <= 1")

3. QML Barren Plateaus, Pauli Classical Shadows & Detection Loopholes (Exp 5, 6, 7 & Paper 2)

from qdsr_audit import (
    barren_plateau_audit,
    run_pauli_shadows_benchmark,
    simulate_lhv_loophole_point,
    compute_cbd_cycle,
    spectral_effective_multiplicity,
)

bp = barren_plateau_audit(n_qubits=6, depth=12, n_samples=200, seed=42)
print(f"Local shots: {bp.shots_required_local_snr1:.1f} vs Global shots: {bp.shots_required_global_snr1:.1f}")

sh = run_pauli_shadows_benchmark(n_qubits=4, n_shots=6000, weight=2, seed=42)
print(f"Classical Shadows max err: {sh.shadow_max_error:.4f} vs Dedicated: {sh.dedicated_max_error:.4f}")

lhv = simulate_lhv_loophole_point(eta=0.828427, n_pairs=80_000, seed=42)
print(f"Post-selected S={lhv['s_post_mc']:.3f} -> Loophole-free S={lhv['s_filled_mc']:.3f}")

Command-Line Interface (qdsr-audit)

# Audit a 4-year Sharpe 3.2 strategy under Grover search + heavy tails
qdsr-audit check --sharpe 3.2 --trials 1000 --t-obs 1000 --mode quantum --tail student_t --nu 3

# Audit a multi-strategy backtest CSV
qdsr-audit csv examples/sample_backtest_returns.csv --tail student_t --nu 3

# Exact unitary Grover simulation
qdsr-audit grover --qubits 10 --nu 3

# Minimax SIPS_infinity four-pillar audit
qdsr-audit sips --mul 0.85 --ood 0.04 --inv 0.03 --col 0.02

# Welch-Superposition <-> MIA privacy duality
qdsr-audit mia --dim 16 --features 64

# Bell-CHSH / LLM detection loophole check
qdsr-audit loophole --eta 0.80

# Pauli Classical Shadows & HEA Barren Plateaus diagnostics
qdsr-audit shadows --qubits 4 --shots 6000 --weight 2
qdsr-audit barren --qubits 6 --depth 12

# Print BibTeX citation & Zenodo CERN DOIs
qdsr-audit cite

Add --json to any analytical subcommand for machine-readable CI/CD and agent integration.


Module Overview

Module Scientific Basis Key Functions
qdsr_audit.qdsr Paper 1 (10.5281/zenodo.24591340) compute_qdsr_audit, exact_evt_scores, exact_evt_threshold, theoretical_amplification_ratio, landauer_selection_bounds, simulate_grover_search, audit_returns_matrix, audit_csv
qdsr_audit.sips Paper 3 (10.5281/zenodo.24591422) compute_sips_audit, compute_manski_rosenbaum_point, compute_welch_mia_duality, build_welch_tight_frame, audit_dictionary_superposition
qdsr_audit.loophole Paper 2 (10.5281/zenodo.24591378) & Exp 7 simulate_lhv_loophole_point, audit_bipartite_chsh, compute_cbd_cycle, spectral_effective_multiplicity
qdsr_audit.qml Software Suite (10.5281/zenodo.24591062) Exp 5–6 run_pauli_shadows_benchmark, bell_fwht_4ary, noisy_bell_memory_threshold, barren_plateau_audit, haar_2design_gradient_variance, compute_geometric_difference

Citation

If you use qdsr-audit in academic research, QML benchmarking, or AI safety evaluations, please cite:

@software{pierret2026qdsr_audit,
  author       = {Pierret, Fabien},
  title        = {qdsr-audit: Open-Source Quantum Overfitting, Post-Selection, and QML Auditing Library},
  year         = {2026},
  version      = {0.1.0},
  publisher    = {Zenodo},
  doi          = {10.5281/zenodo.24591062},
  url          = {https://doi.org/10.5281/zenodo.24591062},
  license      = {MIT},
  note         = {ORCID: 0009-0001-1223-2170}
}

Metadata

Release files for qdsr-audit 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qdsr-audit 0.1.0
File Size Uploaded Provenance Actions
qdsr_audit-0.1.0.tar.gz 63.6 kB Without provenance Details for qdsr_audit-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qdsr-audit 0.1.0
File Interpreter ABI Platform Actions
qdsr_audit-0.1.0-py3-none-any.whl Python 3 none any Details for qdsr_audit-0.1.0-py3-none-any.whl

Total release size: 102.5 kB

Release files / qdsr_audit-0.1.0.tar.gz

Download URL qdsr_audit-0.1.0.tar.gz
Size 63.6 kB
Tags Source
SHA-256 checksum
How to use checksums
39772344078e124a99c8b11d055d0d00376d29855981a03947920c766b10938e
BLAKE2b-256 checksum
How to use checksums
166e9792d5449ab2b16e6c9e0702085fbe10bf4e3273fbe313efd3167e68cc97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / qdsr_audit-0.1.0-py3-none-any.whl

Download URL qdsr_audit-0.1.0-py3-none-any.whl
Size 38.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
426764572616e8fb9ded480b9bf7f2e42a0664abaf3f769395a7575eab6c92bc
BLAKE2b-256 checksum
How to use checksums
fcc863c1d5822e48d244ec6721cf632464e10f2f032fb6b85e0d9ae48388f30d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for qdsr-audit 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page