混合LLM与RAG实现Qiskit代码版本迁移

Qiskit Code Migration with LLMs

精选理由

量子开发者福音!用LLM+RAG自动搞定Qiskit代码跨版本迁移,减少手动返工。Google Gemini Flash-2.5效果最佳,值得看看。

AI 摘要

论文提出一种结合大语言模型与检索增强生成(RAG)的混合方法,自动迁移Qiskit代码版本。该方法利用自动生成的迁移场景分类作为结构化的版本特定知识源。实验评估了Google Gemini Flash-2.5和OpenAI Gpt-oss-20b两种模型,在限制性检索方案下显著减少幻觉,提升描述质量。Google Gemini Flash-2.5在检测复杂重构场景中表现更优。研究证实了数据驱动方法在量子软件工程中的潜力。

原文 · arXiv: OpenAI

Qiskit Code Migration with LLMs

The rapid evolution of Quantum Development Kits (QDKs) introduces a specific form of technical debt that compromises code maintainability and hinders software reuse. In the specialized domain of Quantum Software Engineering (QSE), this challenge is intensified by the scarcity of high-quality training data and the high volatility of emerging frameworks, which often lead general-purpose Large Language Models (LLMs) to produce unreliable or hallucinated results. This paper proposes a hybrid approach integrating LLMs with Retrieval-Augmented Generation (RAG) to automate the migration of Qiskit code across versions. The proposed methodology enhances the precision and reliability of migration suggestions by leveraging an automatically generated taxonomy of migration scenarios as the structured, version-specific knowledge source to guide the models. The approach is implemented through an automated, extensible workflow evaluating LLMs (Google Gemini Flash-2.5 and OpenAI Gpt-oss-20b) under different retrieval schemes (unconstrained and restrictive). Results demonstrate that the taxonomy-based RAG architecture, particularly under the restrictive scheme, significantly reduces hallucinations and improves descriptive quality, with Google Gemini Flash-2.5 showing superior performance in detecting complex refactoring scenarios. These findings confirm the potential of this data-centric methodology to foster technological independence and provide robust, intelligent assistants that mitigate API obsolescence, ensuring the long-term availability of quantum algorithms within a rapidly shifting ecosystem and flattening the learning curve within Quantum Software Engineering (QSE).