Revisiting Quantum Code Generation: Where Should Domain Knowledge Live?
On the map: Retrieval-augmented generation → RAG for code
Abstract (arXiv)
Recent advances in large language models (LLMs) have enabled the automation of an increasing number of programming tasks, including code generation for scientific and engineering domains. In rapidly evolving software ecosystems such as quantum software development, where frameworks expose complex abstractions, a central question is how best to incorporate domain knowledge into LLM-based assistants while preserving maintainability as libraries evolve. In this work, we study specialization strategies for Qiskit code generation using the Qiskit-HumanEval benchmark. We compare a parameter-specialized fine-tuned baseline introduced in prior work against a range of recent general-purpose LLMs enhanced with retrieval-augmented generation (RAG) and agent-based inference with execution feedback. Our results show that modern general-purpose LLMs consistently outperform the parameter-specialized baseline. While the fine-tuned model achieves approximately 47% pass@1 on Qiskit-HumanEval, recent general-purpose models reach 60-65% under zero-shot and retrieval-augmented settings, and up to 85% for the strongest evaluated model when combined with iterative execution-feedback agents -representing an improvement of more than 20% over zero-shot general-purpose performance and more than 35% over the parameter-specialized baseline. Agentic execution feedback yields the most consistent improvements, albeit at increased runtime cost, while RAG provides modest and model-dependent gains. These findings indicate that performance gains can be achieved without domain-specific fine-tuning, instead relying on inference-time augmentation, thereby enabling a more flexible and maintainable approach to LLM-assisted quantum software development.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 5 of its 19 references that are in the map. First posted on arXiv 23 Mar 2026.
Builds on
5 of 19 references.
References · 5
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2024The Faiss librarycited by 370
- 2024Qiskit Code Assistant: Training LLMs for generating Quantum Computing Codecited by 24
- 2026Autoregressive Ranking: Bridging the Gap Between Dual and Cross Encoderscited by 1
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2025Enhancing LLM-based Quantum Code Generation with Multi-Agent Optimization and Quantum Error Correction
- 2025A PennyLane-Centric Dataset to Enhance LLM-based Quantum Code Generation using RAG
- 2025Model-Driven Quantum Code Generation Using Large Language Models and Retrieval-Augmented Generation
- 2026PennySynth: RAG-Driven Data Synthesis for Automated Quantum Code Generation
- 2025QHackBench: Benchmarking Large Language Models for Quantum Code Generation Using PennyLane Hackathon Challenges
- 2026QBugLM: An Agentic Benchmarking Framework for LLM-based Quantum Software Debugging
- 2025PennyCoder: Efficient Domain-Specific LLMs for PennyLane-Based Quantum Code Generation
- 2026Beyond Rules: LLM-Powered Linting for Quantum Programs ↗