Automatic Qiskit Code Refactoring Using Large Language Models
Jos\'e Manuel Su\'arez, Luis Mariano Bibb\'o, Joaquin Bogado, Alejandro Fernandez

TL;DR
This paper introduces a method using large language models to automate the refactoring of Qiskit quantum code, leveraging a taxonomy of migration scenarios to improve compatibility with evolving APIs.
Contribution
It presents a novel approach combining domain-specific migration taxonomy with LLMs to automate Qiskit code refactoring, addressing context limitations and providing effective migration assistance.
Findings
LLMs can effectively identify migration scenarios in Qiskit code.
The approach improves automation of quantum code migration tasks.
Proven prompts and taxonomy enhance LLM guidance for code refactoring.
Abstract
As quantum software frameworks evolve, developers face increasing challenges in maintaining compatibility with rapidly changing APIs. In this work, we present a novel methodology for refactoring Qiskit code using large language models (LLMs). We begin by extracting a taxonomy of migration scenarios from the different sources of official Qiskit documentation (such as release notes), capturing common patterns such as migration of functionality to different modules and deprecated usage. This taxonomy, along with the original Python source code, is provided as input to an LLM, which is then tasked with identifying instances of migration scenarios in the code and suggesting appropriate refactoring solutions. Our approach is designed to address the context length limitations of current LLMs by structuring the input and reasoning process in a targeted, efficient manner. The results demonstrate…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsNatural Language Processing Techniques
MethodsSparse Evolutionary Training
