Table of Contents
Fetching ...

LLM-Powered Quantum Code Transpilation

Nazanin Siavash, Armin Moin

TL;DR

This paper addresses cross-platform interoperability for quantum programming by using large language models as flexible transpilers between QSDKs (e.g., Qiskit and Cirq) to preserve functional equivalence without hand-crafted rules. It presents a framework that inputs quantum programs, uses domain-specific prompts to guide translation, and outputs target-QSDK code. Preliminary findings across multiple LLMs show mixed success, with prompting strategy and model choice significantly impacting correctness and compilability; GPT-4o with targeted prompts appears most promising. The authors propose future work incorporating Retrieval-Augmented Generation and formal transpilation metrics to improve accuracy and extend capabilities.

Abstract

There exist various Software Development Kits (SDKs) tailored to different quantum computing platforms. These are known as Quantum SDKs (QSDKs). Examples include but are not limited to Qiskit, Cirq, and PennyLane. However, this diversity presents significant challenges for interoperability and cross-platform development of hybrid quantum-classical software systems. Traditional rule-based transpilers for translating code between QSDKs are time-consuming to design and maintain, requiring deep expertise and rigid mappings in the source and destination code. In this study, we explore the use of Large Language Models (LLMs) as a flexible and automated solution. Leveraging their pretrained knowledge and contextual reasoning capabilities, we position LLMs as programming language-agnostic transpilers capable of converting quantum programs from one QSDK to another while preserving functional equivalence. Our approach eliminates the need for manually defined transformation rules and offers a scalable solution to quantum software portability. This work represents a step toward enabling intelligent, general-purpose transpilation in the quantum computing ecosystem.

LLM-Powered Quantum Code Transpilation

TL;DR

This paper addresses cross-platform interoperability for quantum programming by using large language models as flexible transpilers between QSDKs (e.g., Qiskit and Cirq) to preserve functional equivalence without hand-crafted rules. It presents a framework that inputs quantum programs, uses domain-specific prompts to guide translation, and outputs target-QSDK code. Preliminary findings across multiple LLMs show mixed success, with prompting strategy and model choice significantly impacting correctness and compilability; GPT-4o with targeted prompts appears most promising. The authors propose future work incorporating Retrieval-Augmented Generation and formal transpilation metrics to improve accuracy and extend capabilities.

Abstract

There exist various Software Development Kits (SDKs) tailored to different quantum computing platforms. These are known as Quantum SDKs (QSDKs). Examples include but are not limited to Qiskit, Cirq, and PennyLane. However, this diversity presents significant challenges for interoperability and cross-platform development of hybrid quantum-classical software systems. Traditional rule-based transpilers for translating code between QSDKs are time-consuming to design and maintain, requiring deep expertise and rigid mappings in the source and destination code. In this study, we explore the use of Large Language Models (LLMs) as a flexible and automated solution. Leveraging their pretrained knowledge and contextual reasoning capabilities, we position LLMs as programming language-agnostic transpilers capable of converting quantum programs from one QSDK to another while preserving functional equivalence. Our approach eliminates the need for manually defined transformation rules and offers a scalable solution to quantum software portability. This work represents a step toward enabling intelligent, general-purpose transpilation in the quantum computing ecosystem.

Paper Structure

This paper contains 5 sections, 1 table.