On Repairing Quantum Programs Using ChatGPT
Xiaoyu Guo, Jianjun Zhao, Pengzhan Zhao
TL;DR
This work investigates the feasibility of using ChatGPT to repair quantum programs, addressing the gap in quantum-specific automated program repair. By evaluating on the Bugs4Q benchmark with multiple prompt strategies, the study demonstrates that ChatGPT can produce correct patches for a substantial portion of bugs, achieving a repair rate around 76% across 38 bugs. The analysis highlights the importance of error feedback, bug descriptions, and prompt design in guiding repairs, while acknowledging limitations in handling unseen quantum algorithms and the semi-automated nature requiring human input. Overall, the results indicate that AI-assisted quantum repair is a promising direction to accelerate debugging and improve reliability in quantum software, warranting further quantum-aware training data and richer benchmarks.
Abstract
Automated Program Repair (APR) is a vital area in software engineering aimed at generating automatic patches for vulnerable programs. While numerous techniques have been proposed for repairing classical programs, the realm of quantum programming lacks a comparable automated repair technique. In this initial exploration, we investigate the use of ChatGPT for quantum program repair and evaluate its performance on Bugs4Q, a benchmark suite of quantum program bugs. Our findings demonstrate the feasibility of employing ChatGPT for quantum program repair. Specifically, we assess ChatGPT's ability to address bugs within the Bugs4Q benchmark, revealing its success in repairing 29 out of 38 bugs. This research represents a promising step towards automating the repair process for quantum programs.
