arXiv:2508.20134cs.AIcs.ET2025-08被引 10

QAgent让大模型自动写量子电路代码,还能自校准应对硬件波动。

QAgent: An LLM-based Multi-Agent System for Autonomous OpenQASM programming

  • 用多智能体协同规划、生成和校准,全流程自动化写OpenQASM代码。
  • 单核任务准确率提升47%-70%,多核流程准确率超88%。
  • 适合需要可靠量子编程的开发者和研究者,尤其关注硬件适配性。

在嘈杂中等规模量子(NISQ)设备上实现硬件感知优化和可靠执行,需在OpenQASM层面编写量子电路,但该过程面临领域规划、迭代代码合成和低层校准的挑战。本文提出QAgent,首个端到端自主的OpenQASM代码生成多智能体系统。QAgent在统一的规划-生成-校准流程中集成模式感知任务规划、示例与工具驱动代码合成、以及硬件感知校准。系统采用检索增强生成(RAG)获取结构化内核知识、示例及后端约束,并通过多智能体协同推理与迭代执行反馈确保正确性。我们在12个代表性量子内核及其组合上评估了五种大型语言模型(LLM)。结果表明,QAgent在单核任务上将Pass@1准确率提升47%-70%,在大模型上多核工作流准确率超过88%,显著优于现有基线。此外,在真实硬件频率漂移条件下,QAgent通过自动校准保持近似单位执行保真度,而基于SDK的LLM方法出现显著退化。结果表明,整合规划、生成与校准对可靠量子程序生成至关重要。QAgent代码已开源:https://github.com/fuzhenxiao/QAgent。

原文摘要 · Abstract (English)

Programming quantum circuits at the OpenQASM level is essential for achieving hardware-aware optimization and reliable execution on noisy intermediate-scale quantum (NISQ) devices, yet it remains challenging due to the need for domain-specific planning, iterative code synthesis, and low-level calibration. In this paper, we present QAgent, the first autonomous multi-agent framework for end-to-end OpenQASM code generation. QAgent integrates schema-aware task planning, example- and tool-driven code synthesis, and hardware-aware calibration within a unified planning-synthesis-calibration workflow. The system leverages retrieval-augmented generation (RAG) to access structured kernel knowledge, examples, and backend constraints, and employs coordinated multi-agent reasoning with iterative execution feedback to ensure correctness. We evaluate QAgent on 12 representative quantum kernels and their compositions across five large language models (LLMs). Results show that QAgent improves Pass@1 accuracy by 47-70% on single-kernel tasks and achieves over 88% accuracy on multi-kernel workflows for large models, substantially outperforming existing baselines. Furthermore, under realistic hardware frequency drift, QAgent maintains near-unit execution fidelity through automated calibration, whereas SDK-based LLM methods suffer significant degradation. These results demonstrate that integrating planning, synthesis, and calibration is critical for reliable quantum program generation. The implementation of QAgent is open-sourced at https://github.com/fuzhenxiao/QAgent

量子计算代码生成多智能体LLM应用

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