Quantum Compilation
From quantum circuits
to hardware execution
A circuit describes the computation. Compilation determines how it can run on a particular machine, and what that implementation will cost.
01 / The compilation problem
Preserve the computation.
Choose its implementation.
A quantum algorithm is expressed through operations on logical qubits. A processor offers a specific instruction set, a pattern of allowed interactions, and constraints on timing and resources. Compilation connects these two descriptions.
The task is to construct an executable implementation that preserves the intended computation while reducing a chosen cost. Many implementations can be equivalent, yet differ substantially in the work required to execute them.
The computation
The circuit, its dependencies and the behaviour that must be preserved.
The target architecture
Supported operations, connectivity, timing and available device information.
The implementation cost
Gate count, depth, duration or an error model, under a practical compilation budget.
A constrained optimisation problem
- The input computation.
- Implementations permitted by target .
- The chosen cost, using device information where relevant.
- An explicit tolerance when approximate synthesis is allowed.
The expression defines the optimisation goal; practical methods need not find a global optimum. For unitary circuits, equivalence accounts for global phase and tracked qubit mappings. Measurement and classical control require the corresponding notion of program equivalence.
02 / Importance and pain points
Small overheads.
Large consequences.
As workloads grow, repeated compilation decisions accumulate into substantial execution costs. IBM’s roadmap illustrates the scale being targeted: circuits containing hundreds of millions to a billion gates on error-corrected systems.
These are planned circuit capacities. They make efficient implementation and scalable compilation increasingly consequential research problems.
IBM Quantum Starling / Target: 2029
100million gates
On 200 logical qubits
IBM Quantum Blue Jay / Target: 2033+
1billion gates
On up to 2,000 logical qubits
IBM roadmap and fault-tolerance announcement. Roadmap targets are subject to change. Counts describe circuit size, not gates per second.
1% of a billion gates is 10 million operations.
This is an arithmetic illustration, not a measured compiler result. The execution benefit depends on which operations are removed and how they affect the critical path.
Routing adds physical work
An interaction between distant qubits can require movement of quantum information. Added SWAPs must themselves be implemented using the target’s native operations, increasing the resources needed for the computation.
Decisions affect what comes next
A placement determines the routing problem. A route changes the qubit mapping and later optimisation opportunities. A choice that helps the next gate can make subsequent interactions more expensive.
Performance objectives compete
Fewer gates need not mean a shorter execution. Operation durations, parallelism and error characteristics also matter. The objective must specify which costs are important for the workload and target.
Compilation must also scale
Searching more candidates consumes classical time and memory. A practical compiler must balance the quality of its output against the cost of finding it, including any model inference used in its decisions.
Fault tolerance changes the cost model.
Error-corrected machines still need compilation. Logical instructions, communication between modules and resources such as magic-state preparation introduce their own constraints. The broader compilation problem persists, although the appropriate actions and objectives differ from physical SWAP routing on today’s devices.
03 / Current approaches
Structure, synthesis
and heuristic search.
Established compilers combine algebraic rewrites, circuit synthesis and search. Exact or numerical methods can optimise bounded subproblems; heuristics help navigate larger placement and routing spaces. Each method balances solution quality with computational effort.
Qiskit coordinates analysis and transformation passes through a configurable pipeline. Its standard stages organise the work, while the algorithms inside those stages make the individual decisions.
Qiskit’s compilation framework- 01
initInitialisation
Prepare the circuit and decompose higher-order operations as required.
- 02
layoutLayout
Choose where the logical qubits are placed on the device.
- 03
routingRouting
Introduce operations that make interactions compatible with connectivity.
- 04
translationTranslation
Express the circuit using the target instruction set.
- 05
optimizationOptimisation
Simplify and resynthesise parts of the resulting circuit.
- 06
schedulingScheduling
Assign timing and account for idle periods when requested.
Stages can contain iterations and conditional passes. Their order matters: a decomposition can expose cancellations, a layout changes the routing task, and routing can create new optimisation opportunities.
Inside the routing stage
How SABRE chooses a SWAP
SABRE tracks dependency-ready gates and the current qubit mapping. It executes available interactions; when routing is needed, it scores nearby candidate SWAPs using hardware distances. Look-ahead includes upcoming gates, while a decay term can discourage repeatedly using the same qubits.
The selected SWAP changes the mapping, and the process continues. Qiskit’s implementation incorporates LightSABRE improvements and supports multiple seeded trials. These are useful baselines for evaluating both routing quality and compilation speed.
A single routing decision
Pending interaction: q₀ and q₂
The research question is how well a decision rule captures the downstream consequences of each action, within the time available to make that decision.
04 / Weylattice
Learning the next
compilation decision.
Weylattice is QuantGates’ quantum compilation engine. Our research direction is to use learned circuit and hardware representations to guide elementary compilation actions, beginning with routing.
We are investigating Transformer-based representations of circuit dependencies, target connectivity and the current mapping, coupled to a learned scorer for legal SWAPs. The aim is to make the relationships between current and upcoming interactions inform the next action.
Proposed routing architecture
Represent the state
Encode dependencies, ready gates, future interactions, hardware connectivity and the current logical-to-physical mapping.
Score legal actions
Use a learned model to estimate the downstream cost of candidate SWAPs under the selected compilation objective.
Apply and continue
The deterministic compiler applies the selected legal operation, updates the mapping and emits any newly available gates before the next decision.
Here, is the current routing state, is the set of eligible legal actions and is a learned cost estimate. This is a proposed decision rule. Correctness rests on legal transformations and explicit mapping updates, independently of the model’s ranking quality.
Evaluate the complete route.
A locally attractive move is useful only if its consequences improve the complete implementation. Evaluation must therefore compare complete routing trajectories under matched targets, objectives and compilation budgets.
A central research question is whether learned decisions improve downstream cost enough to justify inference time. Generalisation to unseen circuits and bounded memory use are part of that question.
- Implementation quality
- Native two-qubit operations, routing overhead, depth and scheduled duration where available.
- Classical cost
- End-to-end compilation time and peak memory, including representation and inference.
- Validity and robustness
- Preserved semantics, target compliance, different circuit families and repeated seeded trials.
- Execution evidence
- Distinguish estimated error objectives from results measured on quantum hardware.
Explore the product
Weylattice in Spinorio Lab
Prepare, inspect and compare circuits for a selected target. Explore the current product and its compiler guide.