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.

Try it on your circuits

Correct answers on quantum hardware Share of shots returning the expected bitstring · Higher is better

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
WorkloadDevice4colorsQiskit O3Success rate ratio
Portfolio QAOA, 8 qubitsIBM Kingston28.8%7.6%3.7×
Portfolio QAOA, 8 qubitsIBM Fez18.7%3.5%5.3×
Option pricing, 7 qubitsIBM Fez15.9%10.5%1.5×
Per-qubit signal, from 0 (random) to 1 (perfect)
WorkloadDevice4colorsQiskit O3Signal ratio
QAOA, 80 qubitsIBM Kingston0.290.241.2×
QAOA, 80 qubitsIBM Fez0.160.131.2×
Correct answers, % of shots
WorkloadDevice4colorsQiskit O3Success rate ratio
VQE ground state, 12 qubitsIBM Kingston15.5%5.1%3×
VQE ground state, 12 qubitsIBM Fez4.6%2.1%2.1×
Hubbard model, 16 qubitsIBM Kingston5.8%3.8%1.5×
Per-qubit signal, from 0 (random) to 1 (perfect)
WorkloadDevice4colorsQiskit O3Signal ratio
kNN classifier, 67 qubitsIBM Kingston0.220.112×
kNN classifier, 67 qubitsIBM Fez0.100.042.5×
Correct answers, % of shots
WorkloadDevice4colorsQiskit O3Success rate ratio
Bernstein-Vazirani, 48 qubitsIBM Kingston19.8%3.7%5.3×
Draper adder, 16 qubitsIBM Kingston17.8%15.3%1.1×
Draper adder, 16 qubitsIBM Fez12.5%3.3%3.7×
Cuccaro adder, 20 qubitsIBM Kingston4.9%2.8%1.7×

Compile your own circuit

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.

Gate counts of the circuits run on hardware Two-qubit gates and circuit depth for the same compiled workloads · Lower is better

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.

Two-qubit gates and depth, 50 to 150 qubits Fewer is better · same machine, same 10 s · IBM heavy-hex

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.

Two-qubit gates by time budget Fewer is better · IBM Benchpress QAOA · IBM heavy-hex
200300400404403385384383273260244244244−32%−35%−37%−36%−36%1 s3 s10 s30 s60 s1 s−32%2734043 s−35%26040310 s−37%24438530 s−36%24438460 s−36%244383
400600674670648645639471421413413407−30%−37%−36%−36%−36%1 s3 s10 s30 s60 s1 s−30%4716743 s−37%42167010 s−36%41364830 s−36%41364560 s−36%407639
6008001,0001,0811,0441,0131,0041,004716654641636612−34%−37%−37%−37%−39%1 s3 s10 s30 s60 s1 s−34%7161,0813 s−37%6541,04410 s−37%6411,01330 s−37%6361,00460 s−39%6121,004
2,0003,0003,0182,9112,8972,8912,8512,0191,7291,7291,7021,646−33%−41%−40%−41%−42%1 s3 s10 s30 s60 s1 s−33%2,0193,0183 s−41%1,7292,91110 s−40%1,7292,89730 s−41%1,7022,89160 s−42%1,6462,851
  • 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.

Lower two-qubit depth, by circuit family Median per family · IBM heavy-hex · 10 s

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.

Compile your own circuit

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.

TargetQubitsNative gates
Heron r2/r3 (fez, boston)156cz, ecr, cx, rz, sx, x, rzz
Nighthawk (miami)120cz, ecr, cx, rz, sx, x, rzz
TargetQubitsNative gates
Garnet20cz, prx
Emerald54cz, prx
TargetQubitsNative gates
Cepheus-1108cz, rx, rz
TargetQubitsNative gates
Forte 136gpi, gpi2, ms, zz
TargetQubitsNative gates
H256u1q, rz, rzz
Helios98u1q, rz, rzz
TargetQubitsNative gates
Your topologyAnycz, 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
DeviceCircuit depthTwo-qubit gates
IBM Kingston39% less7% fewer
IBM Fez36% less19% fewer
IBM Marrakesh33% lessabout the same
IBM Aachen25% less19% fewer
IBM Pittsburgh23% lessabout the same
IBM Boston22% less7% fewer
IBM Phoenix22% less14% fewer
IBM Chicago13% less5% fewer
Predicted success with a minute of compilation each, six benchmark circuits
CircuitIBM KingstonIBM Fez
Bernstein-Vazirani, 64 qubits7.6× higher9.8× higher
Bernstein-Vazirani, 48 qubits1.8× higher2.1× higher
Cuccaro adder, 20 qubits2.7× higher2.2× higher
Draper adder, 16 qubits1.2× higher1.9× higher
QAOA 3-regular, 20 qubits1.3× higher1.2× higher
QAOA 3-regular, 24 qubits1.2× higher1.1× higher
Benchmark circuits, median per device
DeviceCircuit depthTwo-qubit gates
IQM Emerald*27% less18% fewer
IQM Emerald46% less9% fewer
IQM Garnet*34% less18% fewer
IQM Garnet34% less4% fewer

* Compared with Qiskit on IQM, IQM's version of Qiskit for its devices.

Benchmark circuits, median per device
DeviceCircuit depthTwo-qubit gates
Rigetti Cepheus26% less6% fewer
Benchmark circuits, median per device
DeviceCircuit depthTwo-qubit gates
IonQ Forte 1, Forte Enterprise 1 and 3, fixed-angle gates77% less48% fewer
IonQ Forte 1, Forte Enterprise 1 and 3, any-angle gates54% lessabout the same
Benchmark circuits, median per device
DeviceCircuit depthTwo-qubit gates
Quantinuum H2-1, H2-2 and Helios-1, fixed-angle gates72% less46% fewer
Quantinuum H2-1, H2-2 and Helios-1, any-angle gates59% lessabout 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.

Fewer two-qubit gates, by family and target Median fewer two-qubit gates than Qiskit O3, per family and target
IBM heavy-hex, 156 qubitssquare 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
Qiskit O3's two-qubit gates on failed couplers 4colors: none on any circuit · IBM heavy-hex · 10 s

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.

Try it on your device and your quantum hardware

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.

  1. 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
  2. 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
  3. 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 GitHub

Set 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 documentation
qiskit
from 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 documentation
python
from 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 Optimizer

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.

Start free trialSee pricing

Academic and research access