Skip to main contentIBM Quantum Documentation

Transpile circuits remotely with the Qiskit transpiler service

The Qiskit® transpiler service provides transpilation capabilities on the cloud. In addition to the local Qiskit transpiler capabilities, your transpilation tasks can benefit from both IBM Quantum™ cloud resources and AI-powered transpiler passes.

The Qiskit transpiler service offers a Python library to seamlessly integrate this service and its capabilities into your current Qiskit patterns and workflows.

Note

This experimental service is only available for IBM Quantum Premium Plan users. The service is an alpha release, subject to change.


Install the qiskit-transpiler-service package

To use the Qiskit transpiler service, install the qiskit-transpiler-service package:

pip install qiskit-transpiler-service

By default, the package tries to authenticate to IBM Quantum services with the defined Qiskit API token, and uses your token from the QISKIT_IBM_TOKEN environment variable or from the file ~/.qiskit/qiskit-ibm.json (under the section default-ibm-quantum).


qiskit-transpiler-service transpile options

  • target (optional, str) - A system name as it would be expected by QiskitRuntimeService (for example, ibm_sherbrooke). If this is set, the transpile method uses the layout from the specified system for the transpilation operation. If any other option is set that impacts these settings, such as coupling_map, the target settings are overridden.
  • coupling_map (optional, List[List[int]]) - A valid coupling map list (for example, [[0,1],[1,2]]). If this is set, the transpile method uses this coupling map for the transpilation operation. If defined, it overrides any value specified for target.
  • optimization_level (int) - The potential optimization level to apply during the transpilation process. Valid values are [1,2,3], where 1 is the least optimization (and fastest), and 3 the most optimization (and most time-intensive).
  • ai (bool) - Whether to use AI capabilities during transpilation. The AI capabilities available can be for AIRouting transpiling passes or other AI synthesis methods. If this value is True, the service applies different AI-powered transpiling passes depending on the optimization_level requested.
  • qiskit_transpile_options (dict) - A Python dictionary object that can include any other option that is valid in the Qiskit transpile() method. If the qiskit_transpile_options input includes optimization_level, it is discarded in favor of the optimization_level specified as parameter input. If the qiskit_transpile_options includes any option not recognized by the Qiskit transpile() method, the library raises an error.

Examples

The following examples demonstrate how to transpile circuits using the Qiskit transpiler service with different parameters.

  1. Create a random circuit and call the Qiskit transpiler service to transpile the circuit with ibm_cairo as the target, 1 as the optimization_level, and not using AI during the transpilation.

    from qiskit.circuit.random import random_circuit
    from qiskit_transpiler_service.transpiler_service import TranspilerService
     
    random_circ = random_circuit(5, depth=3, seed=42).decompose(reps=3)
     
    cloud_transpiler_service = TranspilerService(
        target="ibm_cairo",
        ai=False,
        optimization_level=1,
    )
    transpiled_circuit = cloud_transpiler_service.run(random_circ)
  2. Produce a similar random circuit and transpile it, requesting AI transpiling capabilities by setting the flag ai to True:

    from qiskit.circuit.random import random_circuit
    from qiskit_transpiler_service.transpiler_service import TranspilerService
     
    random_circ = random_circuit(5, depth=3, seed=42).decompose(reps=3)
     
    cloud_transpiler_service = TranspilerService(
        target="ibm_cairo",
        ai=True,
        optimization_level=1,
    )
    transpiled_circuit = cloud_transpiler_service.run(random_circ)

Next steps

Recommendations
Was this page helpful?