English

QHackBench: Benchmarking Large Language Models for Quantum Code Generation Using PennyLane Hackathon Challenges

Artificial Intelligence 2025-09-01 v2 Programming Languages Software Engineering

Abstract

Recent advances in Large Language Models (LLMs) have demonstrated strong potential in code generation, yet their effectiveness in quantum computing remains underexplored. This paper benchmarks LLMs for PennyLane-based quantum code generation using real-world challenges from the Quantum Hackathon (QHack). We introduce QHackBench, a novel benchmark dataset derived from QHack competitions, and evaluate model performance under vanilla prompting and Retrieval-Augmented Generation (RAG). Our structured evaluation framework assesses functional correctness, syntactic validity, and execution success across varying challenge difficulties. Results indicate that RAG-enhanced models, supplemented with an augmented PennyLane dataset, approximately generate similar results as the standard prompting, particularly in complex quantum algorithms. Additionally, we introduce a multi-agent evaluation pipeline that iteratively refines incorrect solutions, further enhancing execution success rates. To foster further research, we commit to publicly releasing QHackBench, along with our evaluation framework and experimental results, enabling continued advancements in AI-assisted quantum programming.

Keywords

Cite

@article{arxiv.2506.20008,
  title  = {QHackBench: Benchmarking Large Language Models for Quantum Code Generation Using PennyLane Hackathon Challenges},
  author = {Abdul Basit and Minghao Shao and Muhammad Haider Asif and Nouhaila Innan and Muhammad Kashif and Alberto Marchisio and Muhammad Shafique},
  journal= {arXiv preprint arXiv:2506.20008},
  year   = {2025}
}

Comments

To appear at the IEEE International Conference on Quantum Artificial Intelligence (QAI), Naples, Italy, November 2025

R2 v1 2026-07-01T03:32:18.570Z