QSpark: Towards Reliable Qiskit Code Generation

Kiana Kheiri, Aamna Aamir, Andriy Miranskyy, Chen Ding
7/16/2025
cs.SEcs.AIquant-ph

No confident code implementation found for this paper.

Abstract

Quantum circuits must be error-resilient, yet LLMs like Granite-20B-Code and StarCoder often output flawed Qiskit code. We fine-tuned the Qwen2.5-Coder-32B model with two RL methods, Group Relative Policy Optimization (GRPO) and Odds-Ratio Preference Optimization (ORPO), using a richly annotated synthetic dataset. On the Qiskit HumanEval benchmark, ORPO reaches 56.29% Pass@1 ($\approx+10$ pp over Granite-8B-QK) and GRPO hits 49%, both beating all general-purpose baselines; on the original HumanEval they score 65.90% and 63.00%. GRPO performs well on basic tasks (44/78) and excels on intermediate ones (41/68), but neither GRPO nor ORPO solves any of the five advanced tasks, highlighting clear gains yet room for progress in AI-assisted quantum programming.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{kheiri2025qspark,
  title  = {QSpark: Towards Reliable Qiskit Code Generation},
  author = {Kiana Kheiri and Aamna Aamir and Andriy Miranskyy and Chen Ding},
  year   = {2025},
  eprint = {2507.12642},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.12642v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.12642.svg)](https://codeofpaper.com/paper/2507.12642)

Discussion