Skip to content
DraconiticResearch
Search Sources API
201,818 studies31 sourcesUpdated 23 min ago
PreprintCC BY 4.0arXiv

QuSema: Detecting Silent Bugs in Quantum Libraries via Quantum-knowledge-enhanced Agents

Abstract

Quantum libraries are now critical infrastructure for quantum algorithm development, yet their correctness remains difficult to test. Existing testing techniques mainly rely on failure-based or comparison-based oracles, exposing bugs only when executions fail, violate runtime checks, or disagree with another implementation. Their applicability is limited when suitable execution-based oracles are unavailable, leaving some silent bugs undetected. Such missed bugs can produce incorrect results that propagate into experimental conclusions, simulation studies, and algorithmic designs. Here we present QuSema, an autonomous testing agent for finding silent bugs in quantum libraries. QuSema uses constraints from quantum semantics and documentation as a source-level semantic oracle to assess whether implementation logic can produce invalid outputs from valid inputs. It operates through an agentic loop that repeatedly inspects library API documentation and source code, reasons about the intended behavior of quantum operations, identifies potential semantic deviations, and validates them by generating executable tests through library APIs. Guided by quantum-domain reasoning, QuSema turns high-level behavioral mismatches into concrete, user-triggerable bug reports, enabling it to uncover non-crash defects. We implement QuSema for Qiskit and PennyLane. On a benchmark of 20 historical silent bugs, QuSema achieves higher mean bug relocation counts than Claude Code and Codex, with the DeepSeek configuration costing less than Claude Code. QuSema also discovers 40 previously unknown bugs confirmed by the developers, including 30 silent bugs.

Related

  1. Capability-Gated Conformance Testing of Quantum Error-Correction Decoder Libraries
    Jiachen Shen, Hui Zhong
    arXivPreprintarXiv licenceFull textQuantum physics & quantum informationarXiv
  2. Quantum corrections as a Bound for Detecting Self-Interacting Ultralight Dark Matter
    Jae-Weon Lee, Chueng-Ryong Ji
    arXivPreprintCC BY 4.0Full textCosmologyHigh-energy & particle physicsarXiv
  3. Detecting symmetry-resolved entanglement: A quantum Monte Carlo approach
    Kuangjie Chen, Weizhen Jia, Xiaopeng Li +2
    SciPost PhysicsPeer-reviewedCC BY 4.0Full textAtomic, molecular & optical physicsCrossref
  4. Detecting quantum non-Gaussianity with a single quadrature
    Clara Wassner, Jack Davis, Sacha Cerf +2
    HALPreprintCC BY 4.0Full textQuantum physics & quantum informationHAL
  5. QML-PipeGuard: Detecting Channel-Substitution Attacks on Quantum Machine Learning Pipelines in Untrusted Clouds
    Esra Yeniaras
    arXivPreprintarXiv licenceFull textQuantum physics & quantum informationarXiv
BibTeX
@misc{song2026qusema,
  title = {{QuSema: Detecting Silent Bugs in Quantum Libraries via Quantum-knowledge-enhanced Agents}},
  author = {Yujin Song and Kaining Zhang and Qixin Zhang and Shuai Wang and Pingchuan Ma and Yuxuan Du},
  howpublished = {arXiv},
  year = {2026},
  month = oct,
  doi = {10.48550/arxiv.2610.10258},
  eprint = {2610.10258},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.10258},
  note = {CC BY 4.0},
}
RIS
TY  - UNPB
TI  - QuSema: Detecting Silent Bugs in Quantum Libraries via Quantum-knowledge-enhanced Agents
AU  - Yujin Song
AU  - Kaining Zhang
AU  - Qixin Zhang
AU  - Shuai Wang
AU  - Pingchuan Ma
AU  - Yuxuan Du
PY  - 2026
DA  - 2026/10/07
PB  - arXiv
DO  - 10.48550/arxiv.2610.10258
UR  - https://arxiv.org/abs/2610.10258
AB  - Quantum libraries are now critical infrastructure for quantum algorithm development, yet their correctness remains difficult to test. Existing testing techniques mainly rely on failure-based or comparison-based oracles, exposing bugs only when executions fail, violate runtime checks, or disagree with another implementation. Their applicability is limited when suitable execution-based oracles are unavailable, leaving some silent bugs undetected. Such missed bugs can produce incorrect results that propagate into experimental conclusions, simulation studies, and algorithmic designs. Here we present QuSema, an autonomous testing agent for finding silent bugs in quantum libraries. QuSema uses constraints from quantum semantics and documentation as a source-level semantic oracle to assess whether implementation logic can produce invalid outputs from valid inputs. It operates through an agentic loop that repeatedly inspects library API documentation and source code, reasons about the intended behavior of quantum operations, identifies potential semantic deviations, and validates them by generating executable tests through library APIs. Guided by quantum-domain reasoning, QuSema turns high-level behavioral mismatches into concrete, user-triggerable bug reports, enabling it to uncover non-crash defects. We implement QuSema for Qiskit and PennyLane. On a benchmark of 20 historical silent bugs, QuSema achieves higher mean bug relocation counts than Claude Code and Codex, with the DeepSeek configuration costing less than Claude Code. QuSema also discovers 40 previously unknown bugs confirmed by the developers, including 30 silent bugs.
ER  -