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

📅 2026-07-28
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This work addresses the limitations of existing large language model (LLM)-based fuzzing approaches for quantum libraries, which often lack flexibility and efficiency in uncovering deep-seated bugs. To overcome these challenges, we propose KQFuzz, a knowledge-guided fuzzing framework that introduces a novel prompting strategy tailored for quantum programs. By integrating domain-specific knowledge from quantum codebases, KQFuzz steers LLMs to generate high-quality seed programs. It further enhances bug-finding capability through a fitness-guided evaluation mechanism and a two-level mutation strategy, enabling efficient exploration of complex execution paths. Experimental results on Qiskit, PennyLane, and Cirq demonstrate that KQFuzz achieves up to an 18.44% improvement in coverage over state-of-the-art baselines and successfully identifies 13 real-world vulnerabilities, 12 of which have been confirmed and patched by developers.
📝 Abstract
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.
Problem

Research questions and friction points this paper is trying to address.

quantum libraries
fuzzing
large language models
software reliability
bug detection
Innovation

Methods, ideas, or system contributions that make the work stand out.

knowledge-guided fuzzing
large language models
quantum libraries
seed generation
fitness-guided mutation