← Latest papers
⚛️ quantum physics

Large Language Models for Quantum Code Translation: An Exploratory Study

This paper proposes and evaluates an LLM-based, quantum-aware workflow for translating executable programs between high-level quantum SDKs, demonstrating that zero-shot and one-shot prompting can achieve high translation success rates (up to 72.33% Pass@1) in converting Qiskit code to PennyLane and Q#.

Original authors: Xiyuan Li, Yuechen Li, Jianjun Zhao

Published 2026-10-27
📖 4 min read🧠 Deep dive

Original authors: Xiyuan Li, Yuechen Li, Jianjun Zhao

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). ✨ This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Quantum computing promises to solve problems that are currently impossible for traditional computers, but building the software to run these machines is a formidable challenge. The difficulty lies not just in the strange rules of quantum physics, which allow particles to exist in multiple states at once, but in the fragmented landscape of tools available to programmers. Currently, different teams build their quantum software using different sets of instructions, much like how different countries speak different languages. A program written for one system often cannot run on another, forcing developers to manually rewrite their code from scratch every time they want to switch tools. This barrier slows down progress and makes it hard for engineers to share their work.

Researchers at Kyushu University and Beihang University have begun to explore whether artificial intelligence can bridge this gap. They investigated if large language models—advanced computer programs trained on vast amounts of text and code—could automatically translate quantum programs from one system to another while keeping their intended behavior intact. Their study focused on converting code written for Qiskit, a popular toolkit from IBM, into two other major systems: PennyLane and Q#. The goal was to see if these AI models could understand the complex logic of quantum mechanics, such as how particles are linked together or how measurements are made, and apply that understanding to rewrite the code correctly without human intervention.

To test this, the team created a workflow where the AI was given a specific quantum task written in the original language and asked to produce an equivalent version in the new language. They did not just ask the AI to guess; they built a system that checked the results rigorously. The translated code was run through the actual software environments of the target systems to see if it executed without errors and produced the correct mathematical outcomes. The researchers tested four different AI configurations on forty-three distinct tasks, ranging from simple operations to more complex sequences. They compared two methods: asking the AI to translate the code immediately without any examples, and asking it to translate after showing it one correct example of how the conversion should look.

The results were encouraging but highlighted significant hurdles. When the AI was asked to translate without any prior examples, the success rate varied widely depending on the model and the target system. The best-performing configuration managed to produce a working translation in roughly seventy-two percent of the cases for one target system and about seventy-one percent for the other. This suggests that these models possess a genuine ability to grasp the structure of quantum code. However, the study also revealed that the AI frequently failed due to practical issues rather than a lack of understanding of the physics. The most common reasons for failure were missing source files or the translated code failing to compile, which means the computer could not even start running the program. These errors accounted for nearly forty percent and thirty-five percent of the failures, respectively.

When the researchers provided the AI with a single example of a correct translation before asking it to perform the task, the performance improved noticeably. The success rate climbed for both models tested, indicating that showing the AI how to handle the specific syntax and rules of the new system helps it avoid mistakes. This finding suggests that while the technology is not yet perfect, it is a viable path forward. The study concludes that large language models hold real potential for automating the translation of quantum software, which could eventually allow developers to move freely between different tools. However, the researchers note that future work must address the remaining barriers, such as ensuring the AI has access to all necessary files and can navigate the complex version differences between software updates, before this approach can become a standard tool for the industry.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →