arXiv:2507.12642cs.SEcs.AI2025-07被引 5

用强化学习优化大模型,生成更可靠的量子程序代码。

QSpark: Towards Reliable Qiskit Code Generation

  • 采用两种强化学习方法优化Qwen2.5模型生成量子电路。
  • 在Qiskit HumanEval上达到56.29%通过率,提升约10个百分点。
  • 适合量子编程初学者与需要高效调试的开发者使用。

量子电路需具备抗错能力,但像Granite-20B-Code和StarCoder这类大模型常生成有缺陷的Qiskit代码。我们使用丰富标注的合成数据集,对Qwen2.5-Coder-32B模型分别采用分组相对策略优化(GRPO)和奇偶比偏好优化(ORPO)进行微调。在Qiskit HumanEval基准测试中,ORPO达到56.29% Pass@1(较Granite-8B-QK提升约10个百分点),GRPO达49%,均优于所有通用基线;在原始HumanEval上得分分别为65.90%和63.00%。GRPO在基础任务(78题中正确44题)表现良好,在中级任务(68题中正确41题)尤为突出,但两者均未解决任何5个高级任务,表明在人工智能辅助量子编程方面已取得显著进展,但仍存提升空间。

原文摘要 · Abstract (English)

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.

量子计算代码生成强化学习Qiskit

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。