Circuit Partitioning Using Large Language Models for Quantum Compilation and Simulations

Pranav Sinha, Sumit Kumar Jha, Sunny Raj · 2025

Read Circuit Partitioning Using Large Language Models for Quantum Compilation and Simulations by Pranav Sinha, Sumit Kumar Jha, Sunny Raj (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2505-07711.txt.

Introduction

Pranav Sinha, Sumit Kumar Jha, and Sunny Raj ask large language models to cut quantum circuits into pieces small enough to optimize. Their 2025 paper works in today's noisy quantum era, where compilers can only polish circuits of a handful of qubits. Anything bigger must be partitioned first, and existing partitioners are heuristics blind to the optimization that follows.

The authors test whether language models, Llama and Mistral among them, partition with the downstream step in mind. A smarter cut means fewer noisy gates survive compilation. The study is an early probe of language models as engineering tools inside the quantum software stack, judged on real circuit quality.

Catalog record

CREATORPranav Sinha, Sumit Kumar Jha, Sunny Raj
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE31 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2505-07711

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Circuit Partitioning Using Large Language Models for Quantum Compilation and Simulations Pranav Sinha, Sumit Kumar Jha, Sunny Raj Abstract We are in the midst of the noisy intermediate-scale quantum (NISQ) era, where quantum computers are limited by noisy gates, some of which are more error-prone than others and can render the final computation incomprehensible. Quantum circuit compilation algorithms attempt to minimize these noisy gates when mapping quantum algorithms onto quantum hardware but face computational challenges that restrict their application to circuits with no more than 5-6 qubits, necessitating the need to partition large circuits before the application of noisy quantum gate minimization algorithms. The existing generation of these algorithms is heuristic in nature and does not account for downstream gate minimization tasks. Large language models (LLMs) have the potential to change this and help improve quantum circuit partitions. This paper investigates the use of LLMs, such as Llama and Mistral, for partitioning quantum circuits by capitalizing on their abilities to understand and generate code, including QASM. Specifically, we teach LLMs to partition circuits using the quick partition approach of the Berkeley Quantum Synthesis Toolkit. Through experimental evaluations, we show that careful fine-tuning of open source LLMs enables us to obtain an accuracy of 53.4% for the partition task while over-the-shelf LLMs are unable to correctly partition circuits, using standard 1-shot and few-shot training approaches. I Introduction Quantum circuit compilation converts a quantum algorithm written in a high-level language into elementary quantum gates supported by the quantum hardware. This conversion consists of multiple steps, including first converting the high-level language into intermediate languages (QASM) before mapping onto the quantum computing hardware. Different quantum computing hardware supports different gates, and as can be expected, the mapping from QASM, which is written using generalized gate sets, to the quantum hardware is an involved and complicated process. A specific challenge is presented by the fact that right now, we are in the midst of the noisy intermediate-scale quantum (NISQ) era [ 1 ] . The current-era quantum computers have qubit sizes in the 1000s and are characterized by noisy quantum gates, some gates being more noisy and error-prone than others. For example, the two-qubit CNOT gate is noisier than other gates, and excess CNOT gates in the compiled circuit can render the output incomprehensible. Multiple compilation algorithms focused on minimizing the number of noisy gates have been proposed in the literature [ 2 ] . These compilation algorithms have computational complexity that is exponential in the number of qubits and cannot be directly applied to circuits larger than 5-6 qubits. Therefore, multiple partitioning methods to break down a large circuit into smaller sub-circuits for compilation have been proposed. The problem of partitioning is equivalent to rearranging the intermediate-level QASM quantum code that enables the best application of the downstream compilation algorithm. Large language models such as GPT and Llama excel at understanding and generating code and have a good knowledge of the QASM code that the partition algorithms work on [ 3 , 4 ] . There is an expectation that they will perform well at the partitioning task, and investigating this expectation is the main focus of this paper. Specifically, we focus on teaching quick partition, a popular partitioning technique, to large language models [ 5 ] . To the best of our knowledge, we are the first to investigate the performance of large language models for partitioning quantum circuits. The paper aims to answer the question of whether a large language model can learn an existing quantum circuit partition algorithm and partition a quantum circuit correctly and, if the circuit is not partitioned correctly, whether the generated code is still correct or not. Through thorough experimental evaluations, we answer the question in the affirmative for both of the questions while making the following observations: • Even with an expert understanding of the QASM programming language, partitioning is challenging for SOTA LLM models. Off-the-shelf models cannot partition using popular few-shot approaches, and acceptable performance is only achieved after carefully fine-tuning the models. • The context size of the LLMs is important for processing large circuits, and earlier models with smaller context sizes do not work well as they can only be trained using small quantum algorithms. • Overall, the best accuracy of 53.4% is obtained by fine-tuning the open-source Llama-3.1 70B model. Accuracy achieved from over-the-shelf LLMs is 0%. • Even in cases when the generated code from the fine-tuned LLM is not equivalent to the code generated by quick partition, the partitioned code is equivalent to the original code in 100% of instances. II Related Work II-A Quantum Circuit Partitioning The NISQ quantum devices are characterized by a number of errors, including state preparation and measurement (SPAM) and qubit state decoherence errors. Two qubit gates like CNOT are more susceptible than one qubit gates and have an error rate that is 1-3% higher than one qubit gates. This issue of error on quantum computers is well known, and consequently, there is a line of work dedicated to optimizing and reducing the number of gates in quantum circuits. The popular QisKit compiler has four levels of optimization from 0 to 3, with level 3 providing the most optimization [ 6 ] . These optimizations include finding logical reductions and commutative possibilities to decrease the gate count. The optimization also uses the noise information of the hardware to select a layout with a favorable noise profile. Patel et al. showed that even after applying all of the optimizations in the QisKit compiler, running TFIM (Transverse Field Ising Model) and Heisenberg quantum algorithms on the relatively low error IBMQ Manila quantum computer, the quantum computer generated results with errors large enough not to provide any meaningful insights [ 7 ] . Existing CNOT gate reduction and optimization in QisKit and other compilation software has shown to be insufficient, and multiple works targeting the reduction of CNOT gates have been proposed in the literature. Davis et al. proposed the QSearch algorithm to decrease the number of CNOT gates [ 2 ] . They build the circuit incrementally and use the A ∗ search strategy along with the Hilbert–Schmidt norm to find fitness and obtain the best solution. The search has exponential complexity in the number of qubits and can only work with circuits of up to 4 qubits effectively. The QGo algorithm introduced by Wu et al. introduced the partitioning of circuits into blocks of 4 qubits to apply the QSearch algorithm [ 8 ] . They proposed the scan partitioner, a greedy heuristic algorithm to find blocks of a certain qubit size that have the highest number of CNOT gates, with the rationale being that the more CNOT gates in a block, the better the reduction using QSearch. After the optimizations are completed, the blocks are merged together to obtain the equivalent of the original circuit. Smith et al. proposed the LEAP algorithm, which improves upon QSearch for multiple metrics [ 9 ] . LEAP is faster, can decrease CNOT gate count by up to 48 \times compared to QSearch, and can scale to 6 qubits. The circuit has to be partitioned similarly to QGo for larger circuits with more qubits. Patel et al. introduced

Read the complete text