arXiv:2508.21097cs.SEcs.AI2025-08中稿 · the New Ideas and …被引 5

用大模型和检索增强生成,从量子系统模型自动生成可运行的代码。

Model-Driven Quantum Code Generation Using Large Language Models and Retrieval-Augmented Generation

  • 结合大模型与代码检索,从UML模型生成Qiskit量子代码。
  • 优化提示词后CodeBLEU得分提升四倍,生成代码更准确一致。
  • 适合量子软件开发、低代码工具研究者参考。

本文提出一种新研究方向:利用大语言模型(LLM)并结合检索增强生成(RAG)管道,实现从模型到代码的转换。聚焦于量子及混合量子-经典软件系统,旨在降低异构平台带来的成本风险,并弥补开发者技能不足的问题。验证了基于软件系统UML模型实例生成代码的可行性。生成的Python代码使用成熟库Qiskit,在门基或电路基量子计算机上执行。所部署的RAG管道整合了来自公开GitHub仓库的示例Qiskit代码。实验表明,精心设计的提示词可使CodeBLEU分数提升达四倍,显著提高生成代码的准确性与一致性。未来可进一步探索将软件系统模型作为RAG信息源,或利用大模型进行代码到代码转换(如编译优化场景)。

原文摘要 · Abstract (English)

This paper introduces a novel research direction for model-to-text/code transformations by leveraging Large Language Models (LLMs) that can be enhanced with Retrieval-Augmented Generation (RAG) pipelines. The focus is on quantum and hybrid quantum-classical software systems, where model-driven approaches can help reduce the costs and mitigate the risks associated with the heterogeneous platform landscape and lack of developers' skills. We validate one of the proposed ideas regarding generating code out of UML model instances of software systems. This Python code uses a well-established library, called Qiskit, to execute on gate-based or circuit-based quantum computers. The RAG pipeline that we deploy incorporates sample Qiskit code from public GitHub repositories. Experimental results show that well-engineered prompts can improve CodeBLEU scores by up to a factor of four, yielding more accurate and consistent quantum code. However, the proposed research direction can go beyond this through further investigation in the future by conducting experiments to address our other research questions and ideas proposed here, such as deploying software system model instances as the source of information in the RAG pipelines, or deploying LLMs for code-to-code transformations, for instance, for transpilation use cases.

量子计算代码生成大模型RAG

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