Source-linked AI summary

Predicting Good Quantum Circuit Compilation Options

Nils Quetschlich, Lukas Burgholzer, Robert Wille

arXiv:2210.08027v3quant-phcs.ET

TL;DR

Choosing a technology, device, compiler, and settings for a quantum circuit requires expertise, leaving end-users without actionable guidance. The paper uses supervised classification to predict a good combination from the circuit. On unseen test circuits, the best combination is predicted for more than three quarters, while more than 95% receive a top-three combination and median compilation time falls by more than one order of magnitude.

  • Problem

    End-users without quantum-computing expertise lack guidance for choosing among compilation technologies, devices, compilers, and settings.

    Source: §I · p. 1
  • Method

    The framework treats option selection as supervised classification and predicts the best compilation-option combination from a quantum circuit.

    Source: §I · p. 1
  • Results

    More than three quarters of unseen test circuits receive the best option combination, more than 95% receive a top-three combination, and median compilation time falls by more than one order of magnitude.

    Source: §I · p. 2
  • Takeaways & Limitations

    The methodology also exposes classifier knowledge that can guide further work and help verify whether a model is reasonably trained.

    Source: §I · p. 2

    Training data must be regenerated and the model retrained when the evaluation metric or available options change; data generation took roughly five days on the authors’ system.

    Source: B. Adaptability to Change · p. 10

Abstract

from arXiv · show

Any potential application of quantum computing, once encoded as a quantum circuit, needs to be compiled in order to be executed on a quantum computer. Deciding which qubit technology, which device, which compiler, and which corresponding settings are best for the considered problem -- according to a measure of goodness -- requires expert knowledge and is overwhelming for end-users from different domains trying to use quantum computing to their advantage. In this work, we treat the problem as a statistical classification task and explore the utilization of supervised machine learning techniques to optimize the compilation of quantum circuits. Based on that, we propose a framework that, given a quantum circuit, predicts the best combination of these options and, therefore, automatically makes these decisions for end-users. Experimental evaluations show that, considering a prototypical setting with 3000 quantum circuits, the proposed framework yields promising results: for more than three quarters of all unseen test circuits, the best combination of compilation options is determined. Moreover, for more than 95% of the circuits, a combination of compilation options within the top-three is determined -- while the median compilation time is reduced by more than one order of magnitude. Furthermore, the resulting methodology not only provides end-users with a prediction of the best compilation options, but also provides means to extract explicit knowledge from the machine learning technique. This knowledge helps in two ways: it lays the foundation for further applications of machine learning in this domain and, also, allows one to quickly verify whether a machine learning algorithm is reasonably trained. The corresponding framework and the pre-trained classifier are publicly available on GitHub (https://github.com/cda-tum/MQTPredictor) as part of the Munich Quantum Toolkit (MQT).

I. INTRODUCTION

Quantum circuit compilation requires choices across hardware, devices, compilers, and settings, but non-experts lack guidance for navigating them. This work proposes supervised classification to predict compilation options from a circuit.

I. INTRODUCTION

  • Unlike classical compilation, quantum compilation lacks comparable guidelines, and device constraints make classical schemes unsuitable for direct adoption.The resulting choice burden is especially difficult for users without quantum-computing expertise.Source: §I · p. 1
  • The framework treats compilation-option selection as supervised classification and predicts a combination of technology, device, compiler, and settings from a circuit.It is intended to make these decisions automatically for end-users.Source: §I · p. 1
  • More than three quarters of unseen test circuits receive the best option combination, and more than 95% receive a top-three combination.The classifier was trained on 3000 circuits; median compilation time fell by more than one order of magnitude compared with manually compiling all combinations.Source: §I · p. 2

A. Motivation

  • End-users must choose among technologies, devices, compilers, and settings as quantum computing expands across application domains and its options evolve.Compiler settings may be poorly documented, while the range of options can exceed what non-experts can feasibly explore.Source: A. Motivation · p. 2

B. Related Work

Prior quantum-compilation work includes resource estimation, capability checks, brute-force compiler comparisons, and machine-learning approaches to narrower challenges. The authors identify a lack of automatic prediction of the best option combination without trying them all.

B. Related Work

  • Classical compiler optimization has used autotuning, machine learning, combined approaches, and reinforcement learning, primarily targeting LLVM.The cited approaches include –.Source: B. Related Work · p. 2
  • Quantum resource estimators estimate hardware needs, while NISQ Analyzer screens architectures by qubit count and maximum supported circuit depth.Resource estimation can require manually supplied hardware data; NISQ Analyzer does not advise which compiler settings or architecture to choose.Source: B. Related Work · p. 3
  • Compiler-comparison tools compile each circuit under every option and report the best result, making per-invocation brute-force search time-consuming and difficult to scale.The option count is expected to grow.Source: B. Related Work · p. 3
  • Quantum machine-learning work has studied execution quality, device-specific fidelity estimation, and reinforcement-learning compilation sequences.The cited studies include, [32], and, respectively.Source: B. Related Work · p. 3
  • The authors report no automatic solution for selecting the best combination without executing and examining every option, and apply classical compiler-optimization techniques to this problem.The cited alternatives may support case studies but are not scalable enough for end-user applications.Source: B. Related Work · p. 3

III. PROPOSED SOLUTION: PREDICTING GOOD COMPILATION OPTIONS

The proposed solution predicts good compilation-option combinations by treating selection as a statistical classification problem. Its search space is built from combinations of technologies, devices, compilers, and settings.

III. PROPOSED SOLUTION: PREDICTING GOOD COMPILATION OPTIONS

  • The method predicts good option combinations as a classification task, avoiding explicit compilation of every candidate combination for each user circuit.The paper frames the task as suitable for supervised machine learning.Source: §III · p. 3

A. Compilation Options and Compilation Pipeline

  • A compilation pipeline realizes each path through the option space, where combinations span qubit technologies, devices, compilers, and settings.The example uses five devices, Qiskit optimization levels O0–O3, and TKET Line Placement or Graph Placement, yielding 30 combinations.Source: A. Compilation Options and Compilation… · p. 3

B. Evaluation Metric

The framework needs an evaluation metric to label compilation combinations as good for a circuit. The example metric checks device capacity and then estimates compiled-circuit fidelity from gate and readout fidelities.

B. Evaluation Metric

  • An evaluation metric may incorporate platform costs or device availability, but a suitable metric should account for compiled-circuit and device characteristics.This may require gathering hardware information such as coherence times and gate fidelities.Source: B. Evaluation Metric · pp. 3–4
  • The example assigns the worst score when a device has fewer physical qubits than the circuit requires, then scores feasible combinations using expected circuit fidelity.The metric treats higher expected fidelity as less noise and better results.Source: B. Evaluation Metric · p. 4
  • Expected circuit fidelity is calculated from gate fidelities and readout fidelities across the compiled circuit’s gates and measurements.The prose defines gate fid(gi), readout fid(qj), |G| as the gate count, and m as the measurement count.Source: B. Evaluation Metric · p. 4

C. Generation of Training Data

Training data pairs quantum circuits with the best compilation-option combination found by exhaustive evaluation. Circuit feature vectors then let a classifier predict good combinations for unseen circuits.

C. Generation of Training Data

  • Training-circuit availability is a key constraint, especially because circuits should represent diverse quantum-computing applications.The passage identifies gathering sufficiently many representative circuits as the biggest challenge.Source: C. Generation of Training Data · p. 4
  • The best-scoring option combination after evaluating all suitable combinations becomes each training circuit’s classification label.The labels are generated from 3000 MQT Bench target-independent circuits spanning 2–127 qubits, with a 300-second timeout per combination.Source: C. Generation of Training Data · p. 4
  • Training circuits are converted into feature vectors so a classifier can predict combinations for unseen circuits.The feature set includes qubit count, circuit depth, gate counts by type, and five composite features.Source: C. Generation of Training Data · p. 4
  • The composite features capture qubit interaction, multi-qubit-gate placement, entanglement, parallelism, and qubit idling.Their definitions describe interaction degree, longest-path multi-qubit gates, multi-qubit gate share, simultaneous execution, and waiting.Source: C. Generation of Training Data · pp. 4–5

D. Solving the Classification Task

The paper frames compilation-option selection as supervised classification, learning complex selection factors without explicit guidelines. Its framework also offers prediction, compilation, and custom-model training functionality.

D. Solving the Classification Task

  • Supervised classifiers can learn complex factors behind compilation-option selection without explicit guidelines.The task is to predict good combinations for unseen circuits without executing and evaluating every possibility.Source: D. Solving the Classification Task · p. 5

IV. RESULTING PREDICTION FRAMEWORK AND ITS PERFORMANCE

  • The framework provides real-time prediction, compilation using the predicted options, and adaptation of the training pipeline for custom models.The implementation is an open-source Python package using scikit-learn.Source: §IV · p. 5
  • Automatic prediction shifts the tedious choice of compilation options from non-expert end-users to a framework with embedded domain knowledge.The framework is presented as a proof-of-concept package available on GitHub as part of the Munich Quantum Toolkit.Source: §IV · p. 5

A. Setting Up the Prediction Framework

The framework requires a defined option set, connected software tools, device information incorporated into an evaluation metric, and suitable training circuits. The evaluated instantiation uses 30 combinations and 3000 circuits, with training labels generated through compilation and evaluation.

A. Setting Up the Prediction Framework

  • Setup defines the technologies, devices, compilers, and settings, connects their software, and incorporates device information into an evaluation metric.A classifier is then trained using a sufficient number of suitable circuits.Source: A. Setting Up the Prediction Framework · p. 5
  • The procedure can incorporate future developments by adjusting or adding the relevant instantiation.Source: A. Setting Up the Prediction Framework · p. 5
  • The evaluation considered superconducting and ion-trap qubits, five devices, Qiskit and TKET, and six total compiler settings.The devices had 8, 27, 80, and 127 qubits for superconducting technology and 11 qubits for ion-trap technology; settings comprised four Qiskit optimization levels and two TKET placement strategies.Source: A. Setting Up the Prediction Framework · p. 5
  • 30 compilation-option combinations were evaluated on 3000 MQT Bench circuits, and a 70%/30% split yielded 2100 training and 900 test samples.Training-data generation produced 38,672 compiled and evaluated circuits and took around 100 hours on a 16-threaded Intel Xeon W-1370P system.Source: A. Setting Up the Prediction Framework · p. 6

B. Resulting Performance

The Random Forest predictions frequently match the best option combination and sharply reduce compilation time relative to exhaustive manual evaluation. The evaluation compares seven classifiers on 900 unseen circuits and illustrates predictions across circuits of different sizes.

B. Resulting Performance

  • The evaluation ranked predictions against stored scores for 900 unseen circuits across 30 option combinations.Rank 1 denotes the best combination and rank 30 the worst.Source: B. Resulting Performance · p. 6
  • The seven classifiers were compared using accuracy, top-three frequency, worst rank, and mean absolute score difference with standard deviation.The results are summarized as ranking histograms in Fig. 3; the supplied passages identify Random Forest as the best-performing classifier.Source: B. Resulting Performance · p. 6, Figure 3 · p. 7
  • For more than three quarters of unseen circuits, Random Forest selected the best combination; over 95% were in the top three, with about 0.2% mean absolute expected-fidelity difference and over an order-of-magnitude median runtime improvement.Fig. 4 shows predicted and evaluated combinations for unseen test circuits, with qubit number on the x-axis; the figure caption reports the prediction is best for the majority of test cases.Source: B. Resulting Performance · p. 6, Figure 4 · p. 8
  • In a 7-qubit Deutsch–Jozsa example, predicting and compiling once took less than a second versus roughly a minute for 30 compilations and evaluations.The example also reports more than an order-of-magnitude reduction in calculation time and selection of the best combination.Source: B. Resulting Performance · pp. 6, 8
  • The Random Forest classifier is provided as a pre-trained model within the Python package.Source: B. Resulting Performance · p. 8

C. Importance of Compilation Options

The evaluation shows that predicted compilation options usually lie near the top of the expected-fidelity spectrum, underscoring how much the choice can affect circuit performance.

C. Importance of Compilation Options

  • Fig. 4 plots normalized expected execution fidelity on the y-axis, with each circuit’s best combination assigned a score of 1.0.Green dots represent possible combinations and purple dots represent the predicted combination; higher scores are better.Source: C. Importance of Compilation Options · p. 8
  • In the vast majority of unseen test circuits, the predicted compilation combination lies near the top of the expected-fidelity spectrum.Fig. 4 compares the predicted combination with all possible combinations for each test circuit.Source: C. Importance of Compilation Options · p. 8
  • The chosen compilation combination has a significant impact on a circuit’s expected performance and quality.A poor choice can leave a circuit execution unreliable or unable to work at all.Source: C. Importance of Compilation Options · p. 8

V. DISCUSSION

The discussion identifies explainability and training effort as machine-learning challenges, then shows how Random Forest feature importance can expose model behavior and support further work and model checks.

V. DISCUSSION

  • Machine-learning techniques pose two challenges: opaque predictions and the effort of training and preparation, which limits adaptability to change.The discussion proposes approaches to mitigate both challenges.Source: §V · p. 8
  • The evaluation’s expected-fidelity metric and compilation-option setting are not universal: the authors describe the setting as representative and adjustable for other setups.The ranking of option combinations depends on the evaluation metric.Source: §V · p. 8

A. Knowledge Extraction

  • A Random Forest combines 100 Decision Trees in this evaluation, and feature importance measures each feature’s normalized influence through average gini-impurity reduction.Fig. 5 illustrates a tree in which feature-based decisions lead to a terminal node predicting a compilation-option combination.Source: A. Knowledge Extraction · p. 9, Figure 5 · p. 9
  • Fourteen of 31 features have importance of at least 2.5%, while the other 17 are mostly negligible; qubit count ranks highest.The authors explain that a device with too few qubits cannot execute the circuit.Source: A. Knowledge Extraction · p. 9, Figure 6 · p. 9
  • Complex circuit features are more influential than most plain gate counts, with exceptions including h, cx, cp, cz, cu1, swap, and ry.The authors connect multi-qubit gate influence to mapping overhead and note that some gates are native to certain devices or compile more efficiently to certain native gate sets.Source: A. Knowledge Extraction · pp. 9–10
  • Feature-importance knowledge highlights useful circuit-characterizing features and the need for thorough feature engineering.The authors note that rules of thumb become difficult to weigh across many features and compilation-option combinations.Source: A. Knowledge Extraction · p. 10
  • Extracted knowledge also lets users quickly check whether the trained classifier is reasonable.The paper presents this as a use of insights into the best-performing Random Forest classifier.Source: A. Knowledge Extraction · pp. 9–10

B. Adaptability to Change

Keeping the classifier current is difficult because calibration and compilation options can change faster than training data can be regenerated. The framework can reuse stored compiled circuits to reduce regeneration, but updated training data still requires model retraining.

B. Adaptability to Change

  • The model requires renewed training when the evaluation metric or available options change, adding to the effort of machine-learning compilation.Device noise characteristics in the evaluation metric can change from calibration to calibration.Source: B. Adaptability to Change · p. 10
  • Adding options increases training-data generation time and may require updated evaluation scores and classification labels if a new option performs better.The number of devices, technologies, compilers, and compiler options is also increasing.Source: B. Adaptability to Change · p. 10
  • Calibration may occur daily, while generating the training data took roughly five days, making repeated full regeneration and retraining impractical.HPC could speed the process, but the required resources might not be worth the price.Source: B. Adaptability to Change · p. 10
  • When calibration data changes, stored compiled circuits can be re-evaluated rather than regenerated to assign updated values.The updated values are used to determine the classification label.Source: B. Adaptability to Change · p. 10
  • When new compilation options are added, previous training can be reused without re-evaluation, while only the new options must be applied to each training circuit.The classification label is then determined using those newly compiled circuits.Source: B. Adaptability to Change · p. 10
  • Even with reused training data, the model must be retrained when the data are adjusted; warmstart approaches can use an existing model’s parameters to avoid training from scratch.The passage cites neural-network warmstarts as an example.Source: B. Adaptability to Change · p. 10

VI. CONCLUSION

The proposed framework shifts compilation-option selection from end-users to a predictor that maps quantum circuits to combinations of technologies, devices, compilers, and settings. Across 30 combinations, it predicts the best option for more than three quarters of unseen test circuits, while reducing median compilation time by more than an order of magnitude versus compiling every combination.

VI. CONCLUSION

  • More than three quarters of unseen test circuits receive the best option, and more than 95% receive an option in the top three among 30 combinations.Median compilation time is reduced by more than one order of magnitude compared with manually compiling all combinations and choosing the best result.Source: §VI · p. 10
  • The framework takes a quantum circuit as input and predicts a combination of qubit technologies, devices, compilers, and settings, shifting option selection away from end-users.The stated aim is to help users from outside quantum computing realize applications on actual hardware more easily.Source: §VI · p. 10
  • The underlying model provides insight into why decisions were made, allowing end-users to build expertise from predicted results.Source: §VI · p. 10
  • The methodology can be adapted and extended to future qubit technologies, devices, compilers, and compiler settings.Source: §VI · p. 10
Loading 2210.08027v3…