A quantum circuit can be logically unchanged while the physical processor on which it runs changes. How should an experiment account for this when deciding whether to reuse a compiled circuit?

A moving optimization problem

A compiler maps logical operations to the native operations and connections of a physical processor. There may be many valid implementations of the same circuit. They differ in the qubits used, the routes taken by interactions, the number and duration of operations and their estimated error costs.

Gate error estimates and gate durations change between calibrations. Available hardware operations can change too. A circuit compiled using one snapshot of that information may be less attractive under a later snapshot.

This creates a choice for experiments that execute the same circuit repeatedly: retain the implementation, compile again, or recompile only when the expected improvement justifies the cost.

A small decision model

Suppose a research team has two equivalent, hardware-compatible circuit implementations. One is already available. The other can be obtained by spending more classical computing time on compilation.

If each remaining execution would cost less using the second implementation, the total expected saving grows with the number of remaining executions. It may eventually exceed the additional compilation cost. The calculation becomes more interesting if the implementations also differ in the quality of the measurements they produce.

The quantity to compare depends on the experiment. For a fixed shot count it could be the cost and accuracy of an energy estimate. For an experiment seeking a particular statistical precision, it could be the resources needed to reach that precision. These objectives are related to gate counts and execution durations, but they are not identical.

A useful policy must also account for changes to the measurement layout and any classical processing that depends on it. If a circuit is no longer valid for the target, retaining it is no longer an available option.

Illustration. If a new compilation costs C in a common monetary unit and saves d > 0 per remaining execution, it pays for itself after more than C/d executions. For example, a compilation costing two units and saving one tenth of a unit per execution needs more than twenty executions to produce a net saving.

When an available connection disappears

Calibration changes are not always gradual. An operation may be unavailable on a connection that exists in the nominal hardware graph. Consider a direct interaction between two qubits whose connection is removed. If another path connects the two qubits, the interaction can be routed along it with additional SWAPs; if none exists, the circuit needs a different placement. Check instruction-specific availability and direction as well as connectivity. When an existing circuit uses an unavailable instruction, recompile or choose another target before executing it.

A timing illustration

Let C(t) denote the cost of the best valid circuit found within compilation time t, measured using a specified objective. If the objective is expected execution duration, a longer compile can save time on every execution. If the objective is gate count or estimated error, the gain has a different unit and must be evaluated using a suitable model or experiment.

For an idealized timing calculation, a short compile takes 1 second and yields an execution time of 1.2 milliseconds per shot. A longer compile takes 10 seconds and yields 0.8 milliseconds per shot. The additional compilation time is recovered after 9/0.0004 = 22,500 shots, ignoring fixed overheads common to both implementations.

Illustration: standalone Python calculation.

from fractions import Fraction
extra=9
saving=Fraction(4,10000)
assert extra/saving==22500
print(int(extra/saving))

The actual time billed for hardware may depend on scheduling, batching and measurement overhead. Choose the economic quantity that reflects your experiment, rather than converting every gate into a fixed time or error cost.

In an actual service comparison, convert the added classical compilation cost and saved quantum resources into common monetary units, or model their effect on a shared deadline.

Designing an experiment across calibration snapshots

Rather than assume that every recalibration warrants another compilation, we can investigate the question directly.

Choose a family of circuits and a physical target. Preserve the logical inputs, measurement interpretation, compilation options, software versions and the target information used at the time of compilation. Collect subsequent snapshots of the relevant hardware properties.

For each snapshot, compare several policies:

Reuse the original implementation when it remains valid.

Compile again using the updated target and a fixed search budget.

Compile again only when a predefined condition is met, such as a material increase in the estimated cost of the current implementation.

Evaluate the same original computation under each policy. Record two-qubit gate counts, circuit depth, estimated operation costs and the total classical computation used for compilation. Where the target and experiment allow, execute the candidate implementations under comparable conditions and evaluate the experimental quantity of interest.

The order of execution matters. If all reused circuits are evaluated before all newly compiled ones, changes in the processor during the experiment can be mistaken for an effect of compilation. Randomize and interleave the alternatives within blocks where feasible. Record execution times and calibration timestamps, and repeat across calibration sessions to assess uncertainty and drift.

What a calibration estimate tells you

Calibration estimates help rank circuits before execution. For example, two placements using the same number of CZ gates may have different estimated error costs because they use different connections. Hardware measurements of the chosen observable are a separate source of evidence: the estimate does not capture every source of noise or drift.

Where better algorithms fit

A more effective compiler can expand the set of useful choices. It can search for alternative placements and routing decisions within the time the experiment can afford. The scheduling of compilation itself can then become part of the wider experimental design.

The 4colors Quantum Compiler uses target connectivity and calibration information to search for efficient circuit implementations. It provides a way to investigate these questions on your own circuits and target descriptions.

Explore the 4colors Quantum Compiler and try your circuits.

Related reading: What better quantum compilation buys you and What does a quantum compiler do?.