Source-linked AI summary
Evaluating the Effect of the Order of Optimization Passes in Quantum Circuit Optimization
Xiao-Ting Michelle To, Nils Quetschlich, Amr Elsharkawy, Martin Schulz, Robert Wille, Dieter Kranzlmüller
TL;DR
Quantum compilers typically apply optimization passes in sequence, but whether their order matters has been little explored. The paper evaluates selected Qiskit passes in pairs and longer sequences, finding order-dependent circuit outcomes and cases where repeating a pass can correct a weaker sequence.
Problem
Although compilers typically use fixed pass orders, it remains unclear whether order affects optimization results or which order performs best.
Source: §I · p. 1Method
The study evaluates pairwise combinations of 16 selected Qiskit optimization passes and examines repeated-pass correction and sequences with more than two passes.
Source: §VII · p. 10Results
Pass order changed optimized-circuit outcomes in 12 of 120 pairwise combinations, while multi-pass differences consistently involved pairwise dependencies.
Source: §VII · p. 10Takeaways & Limitations
Appending the first pass corrected 7 of 12 suboptimal sequences but sometimes worsened performance, underscoring the importance of initially choosing a good order.
Source: §VI · p. 8
Abstract
from arXiv · showhide
Quantum circuit optimization is critical for mitigating the noise inherent in current quantum hardware. Quantum compilers typically sequentially apply multiple optimizations (also called ``optimization passes'') to improve the circuit. The impact of the order in which these passes are executed has yet been largely unexplored. This paper investigates the significance of the order of optimization passes within quantum circuit compilation, specifically analyzing interactions between different optimization methods and quantifying their mutual influences. Using Qiskit's compiler, we systematically evaluate pairwise combinations of 16 selected optimization passes, measuring circuit depth and gate count across various benchmark circuits. Our findings indicate dependencies between certain optimization passes, demonstrating that the order of the passes affects the optimization quality. In some cases, the worse performing sequence can be corrected through repeated pass application. %such that they are as good as the best performing one by extending the sequence. Experiments on multi-pass sequences show that more than two optimization passes may have an impact on each other but that this always links to the previously found pairwise effects. We observe that it is important to initially choose the best order of optimization passes to get the best possible optimization for the given circuit. The experiments reveal some factors which are important to choose the best, or at least a good, order; among those, the resulting optimization sequence depends the most on the native gate set.
I. INTRODUCTION
The paper examines optimization-pass ordering in quantum compilation, where compilation overhead can produce larger, deeper circuits that harm results under noise. Its findings indicate that pass order can affect circuit outcomes and that some interactions persist in longer sequences.
I. INTRODUCTION
- Compilation overhead can produce larger, deeper circuits, negatively affecting results because of noise.The paper also notes this matters for HPCQC integration, where quantum-subroutine scalability and fidelity affect overall system performance.Source: §I · p. 1
- Pass order affects optimized circuits: the paper reports pairwise dependencies, some cases corrected by repeating a pass, and multi-pass differences linked to pairwise interactions.The study focuses on optimization in the native gate set before mapping.Source: §I · p. 1
II. BACKGROUND
- Quantum compilers transform hardware-independent gates into device-native instructions and perform both target-agnostic and target-dependent optimizations.Compilation bridges high-level algorithms and executable hardware instructions.Source: §II · p. 2
A. Quantum Circuit Optimization in Quantum Compilation
Quantum compilation optimizes circuits across stages, including translation to native gates and hardware mapping. Prior work and compiler practice leave the ordering of optimization passes as an open issue in both classical and quantum settings.
A. Quantum Circuit Optimization in Quantum Compilation
- Compilation proceeds from a target-independent circuit through native-gate translation and mapping, with target-specific optimization possible before and after mapping.The example depicts the connectivity graph used for mapping and the resulting mapped and final optimized circuits.Source: A. Quantum Circuit Optimization in… · p. 2
B. Quantum Circuit Optimization
- Circuit optimization improves efficiency against chosen metrics; common categories include pattern matching, gate cancellation, Hadamard reduction, RZ merging, and depth reduction.Common evaluation metrics include single- and two-qubit gate counts, circuit depth, and fidelity estimation.Source: B. Quantum Circuit Optimization · p. 2
III. RELATED WORK
- Quantum optimization research has focused mainly on optimization methods themselves, with comparatively little research on how methods influence one another during compilation.Source: §III · p. 2
A. Optimization in Classical Compilers
- Classical compiler pass ordering is known as the phase ordering problem; fixed orders are not optimal for every program, and the general problem is undecidable.LLVM and GCC use empirically tuned pass orders, while simplified cases of the problem are decidable.Source: A. Optimization in Classical Compilers · pp. 2–3
B. Circuit Optimization Order in Quantum Compilers
- Quantum compilers generally use predefined pass orders, while tools for selecting passes do not systematically address their ordering and interactions.Qiskit and PennyLane use default pass orders; existing selection approaches include reinforcement learning, genetic algorithms, and dummy-circuit methods.Source: B. Circuit Optimization Order in… · p. 3
C. Optimization Pass Selection
Existing approaches select optimization passes but do not systematically address their ordering. This work evaluates pass sequences before mapping, progressing from pairs to correction tests and multi-pass sequences.
C. Optimization Pass Selection
- Pass-selection approaches include reinforcement learning, genetic algorithms, and dummy-circuit methods, but do not systematically address phase ordering or pass interactions.The MQT Predictor combines passes and in most cases creates circuits better than any tested combination.Source: C. Optimization Pass Selection · p. 3
IV. EXPERIMENTAL SETUP
- The experiments evaluate native-gate-set optimizations before mapping, excluding mapping because it depends strongly on hardware topology.The analysis proceeds from pairwise relations to correction of weaker sequences and then to multi-pass sequences; experiments use Qiskit v2.3.0 and repeated runs showed similar results.Source: §IV · p. 3
A. Optimization Passes
- The study selects 16 of Qiskit’s 32 predefined passes, considering transformation passes while excluding analysis passes, collect-and-collapse passes, and passes requiring hardware-specific information.Selected passes are configured with minimal parameters, and circuits are retranslated to the predefined native gate set after optimization; selected passes may not improve circuits alone but may do so in a longer sequence.Source: A. Optimization Passes · pp. 3–4
- The 16 selected passes form 120 pairs, with both possible orders tested for each pair, yielding 240 sequences per benchmark and native-gate-set combination.Source: A. Optimization Passes · p. 4
B. Metrics
The study compares pass orders using circuit depth and overall gate count, assessing each order against the initial circuit and against alternative orders.
B. Metrics
- Circuit depth and overall gate count are used to compare optimization orders; single- and two-qubit gate counts are combined because experiments found almost no two-qubit gate-count optimization or resulting differences.Source: B. Metrics · p. 4
- For each metric, the order’s optimization result is expressed relative to the initial, non-optimized circuit using R_m(p).C_m(x) is the cost of metric m for circuit x; x_p is the circuit after applying order p, and x_init is the initial circuit.Source: B. Metrics · p. 4
- The study compares two pass orders by comparing their respective R_m(p) values.Source: B. Metrics · p. 4
C. Benchmark Circuits
The benchmarks span several quantum-circuit types, and optimization is performed in native gate sets because most passes work better there. Circuits range from five to twelve qubits, with TemplateOptimization experiments limited to ten.
C. Benchmark Circuits
- Six MQT Bench circuits cover amplitude estimation, Deutsch-Josza, graph state, quantum Fourier transform, fixed random, and VQE two-local benchmarks.They represent problem-solving, oracle, graph, QFT, random, and parameterized-circuit workloads.Source: C. Benchmark Circuits · p. 4
- Because most passes work better in the native gate set, the experiments optimize native-gate circuits rather than hardware-independent circuits.The native gate sets are drawn from those provided by MQT Bench.Source: C. Benchmark Circuits · p. 4
- Circuit sizes span five to twelve qubits, but TemplateOptimization experiments stop at ten because larger experiments can take minutes to days per run.The authors say these small circuits suffice to demonstrate the main findings.Source: C. Benchmark Circuits · p. 4
V. EXPERIMENTAL RESULTS
Pairwise tests find that pass order sometimes changes circuit depth and gate count, with effects that vary by pass pair and native gate set. The experiments identify affected pass pairs and compare their orderings.
A. Pairwise Combinations
- 12 of 120 pass pairs show a difference between sequence orders in circuit depth or gate count.The reported differences summarize the worse-versus-better permutation across the tested instances.Source: A. Pairwise Combinations · p. 5
- Eight of the 16 tested passes exhibit pairwise relations: Optimize1qGates, Optimize1qGatesDecomposition, CommutativeCancellation, CommutativeInverseCancellation, Optimize1qGatesSimpleCommutation, RemoveDiagonalGatesBeforeMeasure, TemplateOptimization, and RemoveIdentityEquivalent.For most affected combinations, the better permutation performs at least as well as the worse one, though individual exceptions occur.Source: A. Pairwise Combinations · p. 5
- The better permutation generally performs better, but two pairs have mean and median differences near zero, leaving no consistently clear ordering.For one pair, depth differs in only one instance, so the authors use gate count to select the better permutation.Source: A. Pairwise Combinations · p. 5
- For CommutativeCancellation and Optimize1qGatesSimpleCommutation, order differences vary by native gate set, largest for Rigetti and absent for IQM.Benchmark-specific differences are less apparent than differences across native gate sets.Source: A. Pairwise Combinations · p. 5, Figure 2 · p. 5
- For Optimize1qGatesDecomposition and Optimize1qGatesSimpleCommutation, p0 usually improves the circuit while p1 produces worse results on the reported metrics.The authors state that assessing how well optimizations work generally across scenarios is outside this work's scope.Source: A. Pairwise Combinations · pp. 5–6
B. Correcting the Order of Passes
The authors test whether repeating a pass can bring a worse two-pass ordering up to the better ordering's result. This correction succeeds in some cases, but not uniformly across pairs, benchmarks, or native gate sets.
B. Correcting the Order of Passes
- The correction test appends the first pass of a pair to the worse ordering, then checks whether that extended sequence matches or improves on the better ordering.The authors also append the first pass to the better sequence to test whether that extra application changes its result.Source: B. Correcting the Order of Passes · p. 6
- Seven of 12 pass pairs can be corrected by appending the first pass to the worse sequence; five pairs cannot.Correction does not succeed for every circuit in those seven pairs; in five cases, the extended worse sequence matches the better sequence, while extending the better sequence changes nothing.Source: B. Correcting the Order of Passes · p. 6
- For Optimize1qGatesSimpleCommutation and TemplateOptimization, extending the worse p0 sequence improves depth, and p0+ is best for dj, graphstate, and vqe two local.For ae, qft, and randomcircuit, p0+ improves on p0 but not on p1.Source: B. Correcting the Order of Passes · pp. 6–7, Figure 4 · p. 7
- For that pass pair, p0+ is best only with Quantinuum's native gate set; p1+ worsens results for IQM and Quantinuum, while other sets show no change.The order remains generally better as p1 across the native gate sets.Source: B. Correcting the Order of Passes · p. 7, Figure 5 · p. 7
- Correction is not guaranteed, and adding a pass can create overhead without changing the resulting circuit.The extended sequence can nevertheless bring a less-performing order to at least the better order's result in some cases.Source: B. Correcting the Order of Passes · p. 7
C. Multi-Pass Sequences
The section tests whether pairwise pass interactions persist in longer sequences and whether other factors alter the best order. It finds multi-pass interactions linked to pairwise dependencies, with the best sequence depending on the native gate set and sometimes the benchmark.
2) Experimental Setup:
- The study systematically permutes sequences of two to five passes; multi-pass runs use five to ten qubits because larger sequence counts become infeasible.The authors state these smaller circuits still represent the main findings.Source: 1) Research Objectives · p. 7, 2) Experimental Setup · p. 7
3) Experiment Results:
- Longer sequences show interacting pairs: differing output circuits increase with the number of pairwise interactions, and the best order can change as passes are added.When order affects the circuit, sequences of at least two passes contain pairwise relations; pass pairs may need reversing in longer sequences.Source: 3) Experiment Results · pp. 7–8
- The best sequence depends on the native gate set; benchmark also matters for IBM Falcon and IonQ, while benchmark and circuit size matter for IQM and Quantinuum.For Rigetti, the native gate set alone determines the best sequence; circuit or size alone does not.Source: 3) Experiment Results · p. 8
VI. DISCUSSION
Pass order affects optimized circuit quality, and repeating a pass can sometimes improve a suboptimal sequence, though not consistently. The authors derive a recommended order while noting its limits and the study’s Qiskit focus.
VI. DISCUSSION
- Pass order differs in 12 of 120 combinations, affecting circuit depth and/or gate count and thus the resulting circuit’s error proneness.The authors connect smaller depth or fewer gates with a less error-prone pass sequence.Source: §VI · p. 8
- Appending the first pass corrects a suboptimal sequence in 7 of 12 cases, improves the circuit in 2, and can also worsen outcomes.The authors therefore emphasize choosing a strong initial order, while noting that repeating a pass can help in specific sequences.Source: §VI · p. 8
- Longer sequences retain at least one pairwise dependency when order matters, but adding passes may reverse the preferred order of an identified pair.The pair remains influential even when its best order changes with other passes.Source: §VI · p. 8
- The study focuses on Qiskit; preliminary t|ket⟩ and Cirq results show similar trends but are not detailed enough for full results.Source: §VI · p. 8
A. Recommendation for Order of Optimization Passes
- The recommended order starts by removing negligible-effect gates, then uses commutation and simplification to expose patterns for further simplification.TemplateOptimization is placed between Optimize1qGatesSimpleCommutation and Optimize1qGatesDecomposition because the first simplification may reveal more patterns.Source: A. Recommendation for Order of… · pp. 8–9
- The recommendation is derived from 16 passes, may not capture every pass’s behavior, and may change with added passes or other factors.The authors present it as a foundation that can be extended.Source: A. Recommendation for Order of… · pp. 8–9
B. Comparison to Qiskit’s Default Order of Passes
The recommended order and Qiskit’s default order do not have a consistent winner across the reported comparisons. In isolation they produce the same result, while in the full compilation chain their outputs differ without a clear overall advantage.
B. Comparison to Qiskit’s Default Order of Passes
- In the full compilation chain, the orders differ but have no clear winner; Fig. 6 shows matching medians and means that differ only in the third decimal place.The recommended order is minimally better in median and mean when gate count is the metric.Source: Figure 6 · p. 9, B. Comparison to Qiskit’s Default… · p. 9
- In isolation, the two optimization sequences produce no difference in the resulting circuit.The authors report this for the Qiskit passes used in the sequence comparison.Source: B. Comparison to Qiskit’s Default… · p. 9
- For circuit depth, Qiskit’s order is better in 17 cases versus 15; for gate count, the recommended order is better in 9 versus 5, so neither order is generally better.Source: B. Comparison to Qiskit’s Default… · pp. 9–10
C. Factors Affecting the Optimal Order of Optimizations
The native gate set is the strongest identified factor in choosing an optimization-pass order, while circuit, circuit size, and earlier or later compiler passes also matter. The impact of correction depends on the circuit and native gate set, and the identified factors are not exhaustive.
C. Factors Affecting the Optimal Order of Optimizations
- The identified factors are important but do not constitute an exhaustive list.Source: C. Factors Affecting the Optimal Order… · p. 10
- The effect of pass order ranges from significant to slight or absent across native gate sets, which determine the gates available for optimization.The given circuit also matters, but its relevance is less apparent and weaker than the native gate set’s.Source: C. Factors Affecting the Optimal Order… · p. 10
- Whether reapplying the first pass improves a sequence depends on both the circuit and the native gate set.This comparison is against the shorter sequences.Source: C. Factors Affecting the Optimal Order… · p. 10
- Circuit size becomes an additional factor when selecting sequences with more than two passes.Source: C. Factors Affecting the Optimal Order… · p. 10
- Earlier or later compilation passes influence how well an optimization-pass order performs, so those transformations also need consideration.Source: C. Factors Affecting the Optimal Order… · p. 10
VII. CONCLUSION AND FUTURE WORK
The evaluation finds that pass order affects circuit quality, with measurable differences in 12 of 120 analyzed pairs, and that repeating a pass can sometimes improve weaker sequences. Multi-pass results show persistent pairwise dependencies, while optimal sequences also depend on circuit and compilation context; further compiler-pass interactions and metrics remain future work.
VII. CONCLUSION AND FUTURE WORK
- The systematic Qiskit evaluation compares optimization sequences using circuit depth and gate count.Source: §VII · p. 10
- 12 of 120 analyzed pass combinations show measurable differences by permutation, and the paper recommends an order that differs from Qiskit’s level 2 and 3 defaults.The results report no impact between the specific passes in those default sequences.Source: §VII · p. 10
- Reapplying the first pass corrected seven of twelve weaker sequences and surpassed the original best in two cases, but sometimes worsened performance.Source: §VII · p. 10
- Multi-pass sequences retain pairwise dependencies, yet the shortest best-performing sequences partly differ from pairwise observations.Source: §VII · p. 10
- The best sequence depends on the native gate set, circuit, circuit size, and earlier or later compiler passes.Source: §VII · p. 10
- Future work should assess other compilation-pass interactions and consider fidelity-oriented or hardware-related metrics, alongside adaptive policies and repeated-pass behavior.Source: §VII · p. 10