# KQFuzz: Knowledge-Guided Fuzzing for Quantum Libraries via Large Language Models

arXiv: https://arxiv.org/abs/2607.25647 · HTML: https://mlsanity.com/paper/2607.25647/

## Key facts

- Cited by 1 papers in the map (data through 14 Oct 2026).
- Builds on 22 of its 67 references that are in the map.
- First posted on arXiv 28 Jul 2026.

## Builds on (most cited first, 22 of 22)

- [Code Llama: Open Foundation Models for Code](https://mlsanity.com/paper/2308.12950/) (2023)
- [Qwen2.5-Coder Technical Report](https://mlsanity.com/paper/2409.12186/) (2024)
- [The Art, Science, and Engineering of Fuzzing: A Survey](https://mlsanity.com/paper/1812.00140/) (2018)
- [Challenges and Opportunities in Quantum Optimization](https://mlsanity.com/paper/2312.02279/) (2023)
- [Quantum Software Engineering: Landscapes and Horizons](https://mlsanity.com/paper/2007.07047/) (2020)
- [MorphQ: Metamorphic Testing of the Qiskit Quantum Computing Platform](https://mlsanity.com/paper/2206.01111/) (2022)
- [Bugs in Quantum Computing Platforms: An Empirical Study](https://mlsanity.com/paper/2110.14560/) (2021)
- [Q-Pilot: Field Programmable Qubit Array Compilation with Flying Ancillas](https://mlsanity.com/paper/2311.16190/) (2023)
- [A Machine Learning-Based Error Mitigation Approach For Reliable Software Development On IBM'S Quantum Computers](https://mlsanity.com/paper/2404.12892/) (2024)
- [Faster and Better Quantum Software Testing through Specification Reduction and Projective Measurements](https://mlsanity.com/paper/2405.15450/) (2024)
- [QChecker: Detecting Bugs in Quantum Programs via Static Analysis](https://mlsanity.com/paper/2304.04387/) (2023)
- [Testing Multi-Subroutine Quantum Programs: From Unit Testing to Integration Testing](https://mlsanity.com/paper/2306.17407/) (2023)
- [Equivalence, Identity, and Unitarity Checking in Black-Box Testing of Quantum Programs](https://mlsanity.com/paper/2307.01481/) (2023)
- [PROMFUZZ: Leveraging LLM-Driven and Bug-Oriented Composite Analysis for Detecting Functional Bugs in Smart Contracts](https://mlsanity.com/paper/2503.23718/) (2025)
- [M2QCode: A Model-Driven Framework for Generating Multi-Platform Quantum Programs](https://mlsanity.com/paper/2510.17110/) (2025)
- [A Methodological Analysis of Empirical Studies in Quantum Software Testing](https://mlsanity.com/paper/2601.08367/) (2026)
- [Understanding Bugs in Quantum Simulators: An Empirical Study](https://mlsanity.com/paper/2603.22789/) (2026)
- [ResolverFuzz: Automated Discovery of DNS Resolver Vulnerabilities with Query-Response Fuzzing](https://mlsanity.com/paper/2310.03202/) (2023)
- [Symbolic Execution for Quantum Error Correction Programs](https://mlsanity.com/paper/2311.11313/) (2023)
- [ZTaint-Havoc: From Havoc Mode to Zero-Execution Fuzzing-Driven Taint Inference](https://mlsanity.com/paper/2506.08838/) (2025)
- [Is Measurement Enough? Rethinking Output Validation in Quantum Program Testing](https://mlsanity.com/paper/2509.16595/) (2025)
- [QEMI: A Quantum Software Stacks Testing Framework via Equivalence Modulo Inputs](https://mlsanity.com/paper/2602.09942/) (2026)

## Built on by (most cited first, 1 of 1)

- [QuSema: Detecting Silent Bugs in Quantum Libraries via Quantum-knowledge-enhanced Agents](https://mlsanity.com/paper/2610.10258/) (2026)

## Abstract (arXiv)

As quantum computing continually improves, ensuring the reliability and correctness of quantum libraries has become increasingly critical. To this end, many LLM-based fuzzing approaches towards quantum libraries have been proposed to uncover potential bugs. However, these methods still suffer from limitations such as insufficient flexibility and low efficiency, which hinder the progress of the quantum computing field. To address these challenges, we propose KQFuzz, a novel knowledge-guided fuzzer for quantum libraries. It leverages comprehensive codebase knowledge to ground LLM-based test generation, synergizing this with fitness-guided evaluation and two-level mutations to explore complex execution paths and trigger potential bugs. Firstly, KQFuzz introduces a novel prompting scheme tailored to quantum programs, which strategically incorporates knowledge of the codebase to efficiently generate high-quality quantum seed programs. Moreover, we develop evaluation and mutation strategies to handle the generated seed programs, facilitating efficient fuzzing execution while further enriching the diversity of the resulting test cases. We implement KQFuzz and conduct fuzzing on three popular quantum libraries, including Qiskit, PennyLane, and Cirq. Experimental results demonstrate that our approach significantly outperforms other state-of-the-art methods, with coverage improved by up to 18.44%. During the development of KQFuzz, we discovered 13 bugs, all of which have been confirmed and 12 have already been fixed by the developers.
