PennyLane
Install
Install
The PennyLane Guide to Quantum Compilation Hero Image

The PennyLane Guide to Quantum Compilation

Any quantum program must be translated into a sequence of machine instructions for execution. That’s the job of the compiler! During translation, the circuit can be optimised to reduce resources – by choosing different decompositions or even changing representations. Compilation for quantum error encoding may even utilise specific frameworks such as Pauli-based computation.

Explore key ideas in this rapidly evolving field.

Overview of quantum compilation

Quantum compilation is a huge field, and the term can be overloaded. When someone uses the term, are they referring to how a circuit is converted to a quantum computer’s native gateset, how a circuit is optimised, or how the control hardware’s instructions are scheduled? The unique challenges associated with quantum computing have led to compilation techniques distinct to those from classical compilation. Here, we begin by defining what quantum compilation actually means.


Circuit optimisation metrics

Why use many resources when few do trick? The ideal quantum program not only executes correctly, but also executes efficiently, and it is the job of the quantum compiler to optimise the program for some quantitative efficiency metric. For example, if circuit depth is to be reduced, then a compiler pass might eliminate some gates.

There is more than one consideration for efficiency, however, and complexity only grows as quantum error correction schemes or hardware models are accounted for. Optimising for more sophisticated metrics, such as Active Volume, may actually lead to higher qubit counts in exchange for lower overall runtime.

Circuit optimisation methods

Many techniques exist for compilers to find more efficient circuits. Here are broad categories for those techniques.

Transforms are simple: They map from one circuit to another, possibly leaving redundant gates behind. Examples include qml.cancel_inverses or qml.merge_rotations.

Pipelines are more sophisticated optimisers; they might consist of numerous transforms, or decompose a large circuit into smaller ones, or simplify via an intermediate representation (IR), or a mix of all! Examples include ZX optimisation or KAK decomposition.


Intermediate representation

When you’re stuck, sometimes it helps to change your perspective. Similarly, finding a different but equivalent representation of the same quantum circuit can sometimes lead to more optimised circuits. Each representation has its advantages, but it appears that chain-optimising across a mix of representations is most effective.

Pauli-based computation

In the Pauli-based computation framework, all logical gates, typically provided in terms of (Clifford + T) operations, are translated to Pauli product rotations (PPRs) and measurements (PPMs). This is useful because these operations naturally lower to QEC primitives in surface codes or qLDPC codes, providing a more systematic framework for QEC encoding.


Hybrid and FTQC compilation

Complicating compilation even further: (i) fault-tolerant quantum computing circuits are enormous and that (ii) classical instructions are essential for quantum programs. If a compiler digested the entire program at once, optimisation would incur huge time and memory costs. Instead, a program must be structured into reused blocks, such as for loops. When a quantum program consists of deeply intertwined quantum and classical instructions, such as mid-circuit measurements, feedforward, and classical control, a hybrid compiler such as Catalyst is needed to create an optimal set of instructions for both quantum and classical hardware.


Documentation

  • qml.compile
  • qml.cancel_inverses
  • qml.transforms
  • qml.merge_rotations
  • catalyst.draw_graph
  • Compiling workflows
  • Compiling circuits

Overview of quantum compilation

Quantum compilation is a huge field, and the term can be overloaded. When someone uses the term, are they referring to how a circuit is converted to a quantum computer’s native gateset, how a circuit is optimised, or how the control hardware’s instructions are scheduled? The unique challenges associated with quantum computing have led to compilation techniques distinct to those from classical compilation. Here, we begin by defining what quantum compilation actually means.


Circuit optimisation metrics

Why use many resources when few do trick? The ideal quantum program not only executes correctly, but also executes efficiently, and it is the job of the quantum compiler to optimise the program for some quantitative efficiency metric. For example, if circuit depth is to be reduced, then a compiler pass might eliminate some gates.

There is more than one consideration for efficiency, however, and complexity only grows as quantum error correction schemes or hardware models are accounted for. Optimising for more sophisticated metrics, such as Active Volume, may actually lead to higher qubit counts in exchange for lower overall runtime.

Circuit optimisation methods

Many techniques exist for compilers to find more efficient circuits. Here are broad categories for those techniques.

Transforms are simple: They map from one circuit to another, possibly leaving redundant gates behind. Examples include qml.cancel_inverses or qml.merge_rotations.

Pipelines are more sophisticated optimisers; they might consist of numerous transforms, or decompose a large circuit into smaller ones, or simplify via an intermediate representation (IR), or a mix of all! Examples include ZX optimisation or KAK decomposition.

Intermediate representation

When you’re stuck, sometimes it helps to change your perspective. Similarly, finding a different but equivalent representation of the same quantum circuit can sometimes lead to more optimised circuits. Each representation has its advantages, but it appears that chain-optimising across a mix of representations is most effective.


Pauli-based computation

In the Pauli-based computation framework, all logical gates, typically provided in terms of (Clifford + T) operations, are translated to Pauli product rotations (PPRs) and measurements (PPMs). This is useful because these operations naturally lower to QEC primitives in surface codes or qLDPC codes, providing a more systematic framework for QEC encoding.


Hybrid and FTQC compilation

Complicating compilation even further: (i) fault-tolerant quantum computing circuits are enormous and that (ii) classical instructions are essential for quantum programs. If a compiler digested the entire program at once, optimisation would incur huge time and memory costs. Instead, a program must be structured into reused blocks, such as for loops. When a quantum program consists of deeply intertwined quantum and classical instructions, such as mid-circuit measurements, feedforward, and classical control, a hybrid compiler such as Catalyst is needed to create an optimal set of instructions for both quantum and classical hardware.


Documentation

  • qml.compile
  • qml.cancel_inverses
  • qml.transforms
  • qml.merge_rotations
  • catalyst.draw_graph
  • Compiling workflows
  • Compiling circuits

Overview of quantum compilation

Quantum compilation is a huge field, and the term can be overloaded. When someone uses the term, are they referring to how a circuit is converted to a quantum computer’s native gateset, how a circuit is optimised, or how the control hardware’s instructions are scheduled? The unique challenges associated with quantum computing have led to compilation techniques distinct to those from classical compilation. Here, we begin by defining what quantum compilation actually means.


Circuit optimisation metrics

Why use many resources when few do trick? The ideal quantum program not only executes correctly, but also executes efficiently, and it is the job of the quantum compiler to optimise the program for some quantitative efficiency metric. For example, if circuit depth is to be reduced, then a compiler pass might eliminate some gates.

There is more than one consideration for efficiency, however, and complexity only grows as quantum error correction schemes or hardware models are accounted for. Optimising for more sophisticated metrics, such as Active Volume, may actually lead to higher qubit counts in exchange for lower overall runtime.


Circuit optimisation methods

Many techniques exist for compilers to find more efficient circuits. Here are broad categories for those techniques.

Transforms are simple: They map from one circuit to another, possibly leaving redundant gates behind. Examples include qml.cancel_inverses or qml.merge_rotations.

Pipelines are more sophisticated optimisers; they might consist of numerous transforms, or decompose a large circuit into smaller ones, or simplify via an intermediate representation (IR), or a mix of all! Examples include ZX optimisation or KAK decomposition.


Intermediate representation

When you’re stuck, sometimes it helps to change your perspective. Similarly, finding a different but equivalent representation of the same quantum circuit can sometimes lead to more optimised circuits. Each representation has its advantages, but it appears that chain-optimising across a mix of representations is most effective.


Pauli-based computation

In the Pauli-based computation framework, all logical gates, typically provided in terms of (Clifford + T) operations, are translated to Pauli product rotations (PPRs) and measurements (PPMs). This is useful because these operations naturally lower to QEC primitives in surface codes or qLDPC codes, providing a more systematic framework for QEC encoding.


Hybrid and FTQC compilation

Complicating compilation even further: (i) fault-tolerant quantum computing circuits are enormous and that (ii) classical instructions are essential for quantum programs. If a compiler digested the entire program at once, optimisation would incur huge time and memory costs. Instead, a program must be structured into reused blocks, such as for loops. When a quantum program consists of deeply intertwined quantum and classical instructions, such as mid-circuit measurements, feedforward, and classical control, a hybrid compiler such as Catalyst is needed to create an optimal set of instructions for both quantum and classical hardware.


Documentation

  • qml.compile
  • qml.cancel_inverses
  • qml.transforms
  • qml.merge_rotations
  • catalyst.draw_graph
  • Compiling workflows
  • Compiling circuits
PennyLane

PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Built by researchers, for research. Created with ❤️ by Xanadu.

Research

  • Research
  • Performance
  • Hardware & Simulators
  • Demos
  • Compilation Hub
  • Quantum Datasets

Education

  • Teach
  • Learn
  • Codebook
  • Coding Challenges
  • Videos
  • Glossary

Software

  • Install PennyLane
  • Features
  • Documentation
  • Catalyst Compilation Docs
  • Development Guide
  • API
  • GitHub
Stay updated with our newsletter

© Copyright 2026 | Xanadu | All rights reserved

TensorFlow, the TensorFlow logo and any related marks are trademarks of Google Inc.

Privacy Policy|Terms of Service|Cookie Policy|Code of Conduct