Quantum compilation
4colors Quantum Compiler
Optimize quantum circuits for your processor, using its connectivity and calibration. The Compiler searches qubit placements, routes and native gates within the compilation time you set.
Results measured on quantum hardware, and compiled-circuit analysis across five hardware vendors.
Start free trialExplore benchmark resultsCompare plans15-day free trial · 120 minutes · No credit card required
Hardware results
More correct answers from the same hardware
Compilation can change what a quantum processor returns, even when the algorithm and the device stay the same.
On selected optimization, chemistry and machine-learning workloads, circuits compiled by 4colors returned more correct answers than established compilation settings.
Portfolio QAOA 8 qubits · IBM Kingston 3.7×
4colors28.8%
Qiskit O37.6%
Bernstein-Vazirani 48 qubits · IBM Kingston 5.3×
4colors19.8%
Qiskit O33.7%
VQE ground state 12 qubits · IBM Kingston 3.0×
4colors15.5%
Qiskit O35.1%
Draper adder 16 qubits · IBM Fez 2.7×
4colors8.1%
Qiskit O32.9%
VQE ground state 12 qubits · IBM Fez 2.1×
4colors4.6%
Qiskit O32.1%
- 4colors
- Qiskit O3
How we measuredClose ×
IBM hardware: the share of shots that returned the exact correct answer, 4,000 shots per compiled circuit, with no error mitigation.
Each result shown is statistically significant, and the repeat runs of each circuit agree. Our rates are rounded down and Qiskit's up.
Both compilers had the same compilation time, approximation settings and device calibration, and both compiled circuits ran on the same hardware; Qiskit at optimization level 3.
Circuit applications
See what compilation changes for your circuits
Explore results from optimization, chemistry, machine learning and quantum algorithms, each with its measure and target processor.
| Correct answers, % of shots | ||||
|---|---|---|---|---|
| Workload | Device | 4colors | Qiskit O3 | Success rate ratio |
| Portfolio QAOA, 8 qubits | IBM Kingston | 28.8% | 7.6% | 3.7× |
| Portfolio QAOA, 8 qubits | IBM Fez | 18.7% | 3.5% | 5.3× |
| Option pricing, 7 qubits | IBM Fez | 15.9% | 10.5% | 1.5× |
| Per-qubit signal, from 0 (random) to 1 (perfect) | ||||
|---|---|---|---|---|
| Workload | Device | 4colors | Qiskit O3 | Signal ratio |
| QAOA, 80 qubits | IBM Kingston | 0.29 | 0.24 | 1.2× |
| QAOA, 80 qubits | IBM Fez | 0.16 | 0.13 | 1.2× |
| Correct answers, % of shots | ||||
|---|---|---|---|---|
| Workload | Device | 4colors | Qiskit O3 | Success rate ratio |
| VQE ground state, 12 qubits | IBM Kingston | 15.5% | 5.1% | 3× |
| VQE ground state, 12 qubits | IBM Fez | 4.6% | 2.1% | 2.1× |
| Hubbard model, 16 qubits | IBM Kingston | 5.8% | 3.8% | 1.5× |
| Per-qubit signal, from 0 (random) to 1 (perfect) | ||||
|---|---|---|---|---|
| Workload | Device | 4colors | Qiskit O3 | Signal ratio |
| kNN classifier, 67 qubits | IBM Kingston | 0.22 | 0.11 | 2× |
| kNN classifier, 67 qubits | IBM Fez | 0.10 | 0.04 | 2.5× |
| Correct answers, % of shots | ||||
|---|---|---|---|---|
| Workload | Device | 4colors | Qiskit O3 | Success rate ratio |
| Bernstein-Vazirani, 48 qubits | IBM Kingston | 19.8% | 3.7% | 5.3× |
| Draper adder, 16 qubits | IBM Kingston | 17.8% | 15.3% | 1.1× |
| Draper adder, 16 qubits | IBM Fez | 12.5% | 3.3% | 3.7× |
| Cuccaro adder, 20 qubits | IBM Kingston | 4.9% | 2.8% | 1.7× |
How we measuredClose ×
Measured on IBM quantum hardware, against Qiskit at optimization level 3 with the same compilation time. Correct answers: the share of shots that returned the expected bitstring. On large circuits, where a fully correct answer is rare: the per-qubit signal, from 0 (random) to 1 (perfect). Shown: statistically significant results whose repeat runs agree. Our values are rounded down and Qiskit's up; the ratio is taken from the shown values.
Circuit optimization
Fewer two-qubit gates, more efficient circuits
The Compiler uses device connectivity, gate availability and calibration to decide placement, routing and circuit structure. See how compilation changes two-qubit gate counts and circuit depth.
Gate counts of the circuits run on hardware
Two-qubit gates and depth of the circuits we ran on hardware, compiled by 4colors and by Qiskit. Both compilers used the same physical qubits for each circuit.
Bernstein-Vazirani · 48 qubits · Kingston −61%
4colors46
Qiskit O3121
VQE ground state · 12 qubits · Fez −25%
4colors524
Qiskit O3702
VQE ground state · 12 qubits · Kingston −21%
4colors524
Qiskit O3664
Portfolio QAOA · 8 qubits · Kingston −15%
4colors500
Qiskit O3594
Draper adder · 16 qubits · Fez −11%
4colors349
Qiskit O3393
Bernstein-Vazirani · 48 qubits · Kingston −65%
4colors92
Qiskit O3265
VQE ground state · 12 qubits · Fez −36%
4colors561
Qiskit O3881
VQE ground state · 12 qubits · Kingston −28%
4colors575
Qiskit O3805
Portfolio QAOA · 8 qubits · Kingston −44%
4colors620
Qiskit O31,123
Draper adder · 16 qubits · Fez −38%
4colors379
Qiskit O3616
- 4colors
- Qiskit O3
How we measuredClose ×
Two-qubit gates and depth of each compiled circuit as submitted to the device; the optimization and chemistry circuits are mirror circuits (a circuit followed by its inverse). Both compilers had the same compilation time and the same device calibration; Qiskit at optimization level 3. Fewer gates do not by themselves guarantee a better result.
Biggest gains on the biggest circuits
The bigger the circuit, the more compilation matters, and the further the Compiler pulls ahead. On a heavy-hex layout, most qubit pairs are not directly connected.
Every interaction between distant qubits costs extra two-qubit gates to bring them together, and each one is another source of noise. On a large circuit, routing decides the result.
The Compiler finds placements and routes that need far fewer of these gates, and packs the rest into fewer layers, so the circuit also finishes before decoherence takes over.
Bernstein-Vazirani · 150 qubits −57%
4colors158
Qiskit O3370
Bernstein-Vazirani · 100 qubits −41%
4colors132
Qiskit O3226
Cuccaro adder · 100 qubits −41%
4colors964
Qiskit O31,634
Cuccaro adder · 50 qubits −33%
4colors470
Qiskit O3706
QAOA 3-regular, 2 layers · 150 qubits −22%
4colors4,528
Qiskit O35,870
QAOA random graph p=0.1 · 100 qubits −15%
4colors6,081
Qiskit O37,184
Bernstein-Vazirani · 150 qubits −55%
4colors149
Qiskit O3337
Bernstein-Vazirani · 100 qubits −43%
4colors128
Qiskit O3226
Cuccaro adder · 100 qubits −42%
4colors797
Qiskit O31,390
Cuccaro adder · 50 qubits −36%
4colors383
Qiskit O3603
QAOA 3-regular, 2 layers · 150 qubits −10%
4colors469
Qiskit O3526
QAOA random graph p=0.1 · 100 qubits −24%
4colors836
Qiskit O31,109
- 4colors
- Qiskit O3
How we measuredClose ×
4colors Quantum Compiler vs Qiskit at optimization level 3 (better of two seeds kept), each given the same time budget, on the IBM heavy-hex 156-qubit target with a published device calibration. 5 seeds per circuit, median over seeds. Qiskit was run on the 169 working couplers and on the full 176-coupler map; every number is against the lower of its two counts. 4colors uses the calibration and never places gates on failed couplers. Timed runs on a dedicated machine.
Ahead from the first second
You set the time, and the Compiler spends it improving your circuit. Short budgets suit quick iteration in a notebook; longer ones polish the final circuit you send to hardware.
Given more time, the Compiler keeps finding better circuits, with the largest gains on the largest circuits. Each better circuit reaches you as it is found, so you can stop as soon as it is good enough.
- 4colors
- Qiskit O3
How we measuredClose ×
4colors Quantum Compiler vs Qiskit at optimization level 3 (better of two seeds kept), each given the same time budget, on the IBM heavy-hex 156-qubit target with a published device calibration. 5 seeds per circuit, median over seeds. Qiskit was run on the 169 working couplers and on the full 176-coupler map; every number is against the lower of its two counts. 4colors uses the calibration and never places gates on failed couplers. Timed runs on a dedicated machine. Circuits from IBM's Benchpress suite.
Shallower circuits across workloads
Two-qubit depth is the number of sequential two-qubit layers: how long the qubits must hold their state. The Compiler keeps it low across workloads, so more of your circuit runs inside the coherence window.
Depth falls even where the gate count changes little: the Compiler arranges gates so that more of them run side by side in the same layer. Fewer layers also mean less idle time, when errors build up while qubits wait.
Bernstein-Vazirani 4 circuits
4colors−32%
QAOA 3-regular, 1 layer 4 circuits
4colors−28%
UCCSD LiH 2 circuits
4colors−23%
- Median lower two-qubit depth than Qiskit O3
How we measuredClose ×
Per circuit, the change in two-qubit depth against Qiskit O3 (median over seeds); per family, the median over its circuits. Shown: the families where 4colors is 10% or more lower. QFT-type circuits are left out, because Qiskit's output is approximate there.
On IBM heavy-hex, Qiskit was given the full 156-qubit, 176-coupler map, failed couplers included. 4colors uses only working couplers.
4colors Quantum Compiler vs Qiskit at optimization level 3 (better of two seeds kept), same time budget, on four targets: IBM heavy-hex 156 qubits, square lattices of 108 qubits (CZ), 54 and 20 qubits (PRX). 5 seeds per circuit, median over seeds. Timed runs on a dedicated machine.
Supported targets
Compile for the processor you use
Compile for IBM, IQM, Rigetti, IonQ and Quantinuum processors, or for your own hardware definition. The Compiler adapts to each target's connectivity and native gates, and uses calibration where the device publishes it.
Inputs: Qiskit circuits and OpenQASM 2/3, including symbolic parameters.
Output: a circuit in the target's native gates, with its qubit mapping and metrics.
| Target | Qubits | Native gates |
|---|---|---|
| Heron r2/r3 (fez, boston) | 156 | cz, ecr, cx, rz, sx, x, rzz |
| Nighthawk (miami) | 120 | cz, ecr, cx, rz, sx, x, rzz |
| Target | Qubits | Native gates |
|---|---|---|
| Garnet | 20 | cz, prx |
| Emerald | 54 | cz, prx |
| Target | Qubits | Native gates |
|---|---|---|
| Cepheus-1 | 108 | cz, rx, rz |
| Target | Qubits | Native gates |
|---|---|---|
| Forte 1 | 36 | gpi, gpi2, ms, zz |
| Target | Qubits | Native gates |
|---|---|---|
| H2 | 56 | u1q, rz, rzz |
| Helios | 98 | u1q, rz, rzz |
| Target | Qubits | Native gates |
|---|---|---|
| Your topology | Any | cz, cx, ecr, rz, sx, x, prx |
Across devices
Circuit efficiency across devices
Every device has its own layout, native gates and calibration. We compiled the same benchmark circuits with 4colors and with Qiskit for each device, and compared circuit depth, two-qubit gates and predicted success.
Highlights from the compiled circuits
- 77% less circuit depth than Qiskit on IonQ devices, with fixed-angle gates
- 3× higher predicted success than Qiskit on IQM devices
- 39% less circuit depth than Qiskit on IBM Kingston
- 46% fewer two-qubit gates than Qiskit on Quantinuum devices, with fixed-angle gates
| Benchmark circuits, median per device | ||
|---|---|---|
| Device | Circuit depth | Two-qubit gates |
| IBM Kingston | 39% less | 7% fewer |
| IBM Fez | 36% less | 19% fewer |
| IBM Marrakesh | 33% less | about the same |
| IBM Aachen | 25% less | 19% fewer |
| IBM Pittsburgh | 23% less | about the same |
| IBM Boston | 22% less | 7% fewer |
| IBM Phoenix | 22% less | 14% fewer |
| IBM Chicago | 13% less | 5% fewer |
| Predicted success with a minute of compilation each, six benchmark circuits | ||
|---|---|---|
| Circuit | IBM Kingston | IBM Fez |
| Bernstein-Vazirani, 64 qubits | 7.6× higher | 9.8× higher |
| Bernstein-Vazirani, 48 qubits | 1.8× higher | 2.1× higher |
| Cuccaro adder, 20 qubits | 2.7× higher | 2.2× higher |
| Draper adder, 16 qubits | 1.2× higher | 1.9× higher |
| QAOA 3-regular, 20 qubits | 1.3× higher | 1.2× higher |
| QAOA 3-regular, 24 qubits | 1.2× higher | 1.1× higher |
| Benchmark circuits, median per device | ||
|---|---|---|
| Device | Circuit depth | Two-qubit gates |
| IQM Emerald* | 27% less | 18% fewer |
| IQM Emerald | 46% less | 9% fewer |
| IQM Garnet* | 34% less | 18% fewer |
| IQM Garnet | 34% less | 4% fewer |
* Compared with Qiskit on IQM, IQM's version of Qiskit for its devices.
| Benchmark circuits, median per device | ||
|---|---|---|
| Device | Circuit depth | Two-qubit gates |
| Rigetti Cepheus | 26% less | 6% fewer |
| Benchmark circuits, median per device | ||
|---|---|---|
| Device | Circuit depth | Two-qubit gates |
| IonQ Forte 1, Forte Enterprise 1 and 3, fixed-angle gates | 77% less | 48% fewer |
| IonQ Forte 1, Forte Enterprise 1 and 3, any-angle gates | 54% less | about the same |
| Benchmark circuits, median per device | ||
|---|---|---|
| Device | Circuit depth | Two-qubit gates |
| Quantinuum H2-1, H2-2 and Helios-1, fixed-angle gates | 72% less | 46% fewer |
| Quantinuum H2-1, H2-2 and Helios-1, any-angle gates | 59% less | about the same |
How we measuredClose ×
Compiled circuits, not hardware runs, compared with Qiskit at optimization level 3 (O3); rows marked * in the IQM table with Qiskit on IQM. The benchmark circuits from our hardware tests (fewer where a circuit is wider than the device), compiled by both compilers with the same compilation time for each device's published calibration. Depth and two-qubit gates: the median over those circuits, per device. Predicted success: the median gain over those circuits on each platform's devices, estimated from the calibration. With a minute of compilation, Qiskit keeps its best of hundreds of seeds; the lower of two calibration snapshots is shown. On trapped-ion devices, "fixed-angle gates" means both compilers use only the fully entangling two-qubit gate; "any-angle gates" also allows partial two-qubit rotations.
Performance
Gate savings by circuit family and device
The same gains on other devices
The Compiler performs well across devices. Whatever the topology or native gate set, it finds leaner circuits, so one compiler serves your whole hardware portfolio.
Give it your device's coupling map and native gates, and it compiles for the hardware as it stands today, routing around failed couplers.
| IBM heavy-hex, 156 qubits | square lattice, 108 qubits (CZ) | square lattice, 54 qubits (PRX) | square lattice, 20 qubits (PRX) | |
|---|---|---|---|---|
| Bernstein-Vazirani | −31% | −35% | −25% | −4% |
| UCCSD LiH | −12% | −23% | −24% | −25% |
| QAOA 3-regular, 1 layer | −9% | −10% | −10% | −7% |
How we measuredClose ×
Per circuit, the change in two-qubit gates against Qiskit O3 at optimization level 3 (median over seeds); per family and target, the median over the family's circuits. A dash: no result shown for that pair.
On IBM heavy-hex, Qiskit was given the full 156-qubit, 176-coupler map, failed couplers included. 4colors uses only working couplers.
Per target, at a 10 s budget in exact mode: IBM heavy-hex, 156 qubits: fewer two-qubit gates on 12 of 29 circuits, equal on 11; square lattice, 108 qubits (CZ): fewer two-qubit gates on 11 of 29 circuits, equal on 14; square lattice, 54 qubits (PRX): fewer two-qubit gates on 11 of 29 circuits, equal on 13; square lattice, 20 qubits (PRX): fewer two-qubit gates on 5 of 16 circuits, equal on 9.
4colors Quantum Compiler vs Qiskit at optimization level 3 (better of two seeds kept), same time budget, on four targets: IBM heavy-hex 156 qubits, square lattices of 108 qubits (CZ), 54 and 20 qubits (PRX). 5 seeds per circuit, median over seeds. Timed runs on a dedicated machine.
Gates only on couplers that work
Real devices have couplers that the calibration marks as failed. Qiskit, given the full device map, routed gates through them. The Compiler reads the calibration and keeps every gate on working couplers.
Gates on failed couplers
- 0 by 4colors, on every circuit
- Up to 220 by Qiskit O3 on a single circuit
QAOA random graph p=0.1 · 100 qubits
Qiskit O3220
QAOA 3-regular, 2 layers · 150 qubits
Qiskit O3197
Benchpress QAOA (Barabasi-Albert, 3 layers) · 50 qubits
Qiskit O360
Cuccaro adder · 100 qubits
Qiskit O347
Bernstein-Vazirani · 150 qubits
Qiskit O314
How we measuredClose ×
Failed couplers as marked in the device calibration we used, not today's live device.
4colors Quantum Compiler vs Qiskit at optimization level 3 (better of two seeds kept), each given the same time budget, on the IBM heavy-hex 156-qubit target with a published device calibration. 5 seeds per circuit, median over seeds. Qiskit was run on the 169 working couplers and on the full 176-coupler map; this chart shows its full-map output. 4colors uses the calibration and never places gates on failed couplers. Timed runs on a dedicated machine.
Research productivity
Get more from every hardware run
Better compilation can improve what you learn from a hardware run. On the tested workloads, 4colors compiled circuits that returned more correct answers from the same shot budget.
More useful observations
More correct answers per run give you more useful observations from the same number of shots.
Better use of execution budgets
When you need a set number of correct observations, a higher success probability needs fewer shots to reach it.
More room to explore
Better compiled circuits help your team test more configurations and make more of limited hardware access.
Start free trialPlans and limitsSolving QUBO or Ising models? Explore the Optimizer for QUBO
How it works
From your circuit to a better one
Choose the hardware target, optimization objective and compilation budget. 4colors searches for better placements, routes and native-gate implementations, then returns the circuit, mapping, metrics and verification status.
Input
- Circuit Qiskit or OpenQASM 2/3
- Target Device architecture, with optional calibration data
- Time budget From 1 s to 600 s
- Parameters Symbolic parameters kept for repeated experiments
4colors Quantum Compiler
- Placement Chooses the physical qubits for your circuit
- Routing Finds efficient paths through the device connectivity
- Native gates Builds circuits from the gates your device supports
- Search Keeps improving the circuit until the time budget is spent
Output
- Compiled circuit With the qubit mapping
- Metrics Gate counts, depth and target-specific output
- Live results The first circuit, every improvement and the final circuit
- Parameterized circuit Bind new values without recompiling
Workflow
Make compilation time work for you
Code examples on GitHubSet a compilation budget and the Compiler improves its result within the time available. Choose two-qubit gate count or circuit depth as the objective, and use Qiskit, Python or the API.
Existing code
Qiskit plugin
Drop it into your Qiskit workflow as a pass manager.
Qiskit plugin documentationfrom fourcolors.quantum.compiler import generate_pass_managerpm = generate_pass_manager(backend, time_budget_s=30)compiled = pm.run(qc)Scripts and notebooks
Python module
Submit a job and follow each better circuit as it arrives.
Python module documentationfrom fourcolors.quantum import compiler, targetstarget = targets.design_lattice("heavy_hex_156_cz") # a real device: targets.from_qiskit(backend)job = compiler.submit(open("circuit.qasm").read(), target, time_budget_s=30)for res in job.incumbents(): print(res.metrics["two_qubit_gates"], res.metrics["depth"])print(res.circuit)Any language or pipeline
Direct API
Submit from any language, follow results live, and stop early when the circuit is good enough.
API documentation- POST /v1/jobs
- Submit a circuit and a time budget
- GET /v1/jobs/{id}/events
- Follow each better circuit live
- GET /v1/jobs/{id}
- Read the final circuit and its metrics
- POST /v1/jobs/{id}/stop
- Stop early and keep the best circuit
Features
Features built for real devices
Placement and routing
Search qubit placement and routing choices that fit your device's actual connectivity.
Calibration-aware
Measured qubit, coupler and gate characteristics guide compilation, not gate count alone.
Native gates
Target your hardware's native gate set, with the qubit mapping kept in the result.
Repeatable mode
The same circuit, options and seed give a byte-identical circuit on the same release.
Your time budget
From 1 s to 600 s: set how long to search and keep the best circuit found.
Verified results
Each result carries its verification status; larger circuits are labeled when a full proof is not available.
Built for timed workflows
A warm, ready native service: the best circuit found within the time you set, streamed as it improves.
Exact or approximate
Exact by default; or allow a maximum error and inspect the reported distance.
Missing something?
Tell us which feature would help your work.
Request a feature
Under the hood
Circuit compilation is an optimization problem
Placement, routing and gate choice interact: a swap that makes the next gate cheap can make a later one expensive. The Compiler treats the whole circuit as one optimization problem and searches layouts, routes and native gates together.
The search runs on the 4colors Optimizer. Your time budget is its search budget: a good circuit early, better ones as it runs.
Powered by
4colors Optimizer
Original search algorithms for placement, routing and gate choices, tested on demanding benchmarks. Also powers the Optimizer for Scheduling, the Optimizer for QUBO and the planning apps.
Explore the 4colors OptimizerFurther reading
The ideas behind quantum compilation
Explore all articles and guides- Guide
What does a quantum compiler do?
Learn what a quantum compiler does, how qubit mapping and routing affect circuits, and how to evaluate compilation quality.
Read the guide - Insight
The hidden decisions in quantum circuit compilation
Mapping, routing and native gates determine what a logical circuit costs on hardware.
Read the insight - Insight
What better quantum compilation buys you
What fewer gates can mean for execution, and what they cannot establish on their own.
Read the insight - Insight
What is quantum optimization, and where does classical computing fit?
Where circuit compilation sits in a quantum optimization workflow.
Read the insight - Insight
CPU, GPU and QPU: different machines, different strengths
A clear account of what each computing platform contributes.
Read the insight
See what better compilation can do for your circuits
Bring a circuit and a target processor, and see how 4colors compilation changes its structure and the results it returns.