Table of Contents
Fetching ...

Circuit Partitioning Using Large Language Models for Quantum Compilation and Simulations

Pranav Sinha, Sumit Kumar Jha, Sunny Raj

TL;DR

This paper addresses partitioning large quantum circuits to enable downstream noise-aware gate minimization in the NISQ era by teaching open-source LLMs to emulate the Berkeley quick partition algorithm on QASM. It presents a data preparation and LoRA-based fine-tuning workflow that adapts several transformer models to perform partitioning, using barrier-based prompts and barrier markers to guide output. The best result, from fine-tuned Llama-3.1-70B, achieves $53.39\%$ exact partition accuracy, with all generated partitions maintaining equivalence to the original circuit, underscoring the potential of task-specific LLM fine-tuning for quantum circuit optimization. The findings suggest that LLM-guided partitioning can scale beyond traditional qubit limits and influence downstream synthesis and simulation tasks, paving the way for more integrated quantum software tooling.

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.

Circuit Partitioning Using Large Language Models for Quantum Compilation and Simulations

TL;DR

This paper addresses partitioning large quantum circuits to enable downstream noise-aware gate minimization in the NISQ era by teaching open-source LLMs to emulate the Berkeley quick partition algorithm on QASM. It presents a data preparation and LoRA-based fine-tuning workflow that adapts several transformer models to perform partitioning, using barrier-based prompts and barrier markers to guide output. The best result, from fine-tuned Llama-3.1-70B, achieves exact partition accuracy, with all generated partitions maintaining equivalence to the original circuit, underscoring the potential of task-specific LLM fine-tuning for quantum circuit optimization. The findings suggest that LLM-guided partitioning can scale beyond traditional qubit limits and influence downstream synthesis and simulation tasks, paving the way for more integrated quantum software tooling.

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.
Paper Structure (12 sections, 3 figures, 2 tables, 1 algorithm)

This paper contains 12 sections, 3 figures, 2 tables, 1 algorithm.

Figures (3)

  • Figure 1: QASM code of the benchmark graphstate indep of MQT Bench and the corresponding partitioned code. The partitioned code shows significant rearrangement from the original code. The QASM code has been generated from the original benchmark where the gates have been written in the order of their execution. The qubit locations have been removed from the barrier instructions to decrease the LLM token count.
  • Figure 2: ChatGPT-4o mini producing QASM code for TFIM. It can understand and write QASM code but is unable to partition the code into blocks.
  • Figure 3: Distribution of the number of circuits in relation to the number of tokens in the MQT Bench dataset. The number of tokens are for Llama3.1.