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.
This experimental service is only available for IBM Quantum Premium Plan users. The service is a beta release, subject to change. If you have feedback or want to contact the developer team, please use this Qiskit Slack Workspace channel(opens in a new tab).
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
).
Note: This package requires Qiskit SDK v1.X.
qiskit-transpiler-service transpile options
backend_name
(optional, str) - A backend 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 backend for the transpilation operation. If any other option is set that impacts these settings, such ascoupling_map
, thebackend_name
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 fortarget
.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
("true", "false", "auto") - Whether to use AI-powered capabilities during transpilation. The AI-powered capabilities available can be forAIRouting
transpiling passes or other AI-powered synthesis methods. If this value is"true"
, the service applies different AI-powered transpiling passes depending on theoptimization_level
requested. If"false"
, it uses the latest Qiskit transpiling features without AI. Finally, if"auto"
, the service decides whether to apply the standard Qiskit heuristic passes or the AI-powered passes based on your circuit.qiskit_transpile_options
(dict) - A Python dictionary object that can include any other option that is valid in the Qiskittranspile()
method. If theqiskit_transpile_options
input includesoptimization_level
, it is discarded in favor of theoptimization_level
specified as parameter input. If theqiskit_transpile_options
includes any option not recognized by the Qiskittranspile()
method, the library raises an error.
For more information about the available qiskit-transpiler-service
methods, see the qiskit-transpiler-service API reference. To learn more about the service API, see the Qiskit Transpiler Service REST API documentation.
Examples
The following examples demonstrate how to transpile circuits using the Qiskit transpiler service with different parameters.
-
Create a circuit and call the Qiskit transpiler service to transpile the circuit with
ibm_sherbrooke
as thebackend_name
, 3 as theoptimization_level
, and without using AI during the transpilation.from qiskit.circuit.library import EfficientSU2 from qiskit_transpiler_service.transpiler_service import TranspilerService circuit = EfficientSU2(101, entanglement="circular", reps=1).decompose() cloud_transpiler_service = TranspilerService( backend_name="ibm_sherbrooke", ai="false", optimization_level=3, ) transpiled_circuit = cloud_transpiler_service.run(circuit)
Note: you only can use backend_name devices you have access to with your IBM Quantum account. Apart from the backend_name
, the TranspilerService
also allows coupling_map
as parameter.
-
Produce a similar circuit and transpile it, requesting AI transpiling capabilities by setting the flag
ai
toTrue
:from qiskit.circuit.library import EfficientSU2 from qiskit_transpiler_service.transpiler_service import TranspilerService circuit = EfficientSU2(101, entanglement="circular", reps=1).decompose() cloud_transpiler_service = TranspilerService( backend_name="ibm_sherbrooke", ai="true", optimization_level=1, ) transpiled_circuit = cloud_transpiler_service.run(circuit)
-
Produce a similar circuit and transpile it while letting the service to decide whether to use the AI-powered transpiling passes.
from qiskit.circuit.library import EfficientSU2 from qiskit_transpiler_service.transpiler_service import TranspilerService circuit = EfficientSU2(101, entanglement="circular", reps=1).decompose() cloud_transpiler_service = TranspilerService( backend_name="ibm_sherbrooke", ai="auto", optimization_level=1, ) transpiled_circuit = cloud_transpiler_service.run(circuit)
Citation
If you use any AI-powered feature from the Qiskit transpiler service in your research, use the following recommended citation:
@misc{2405.13196,
Author = {David Kremer and Victor Villar and Hanhee Paik and Ivan Duran and Ismael Faro and Juan Cruz-Benito},
Title = {Practical and efficient quantum circuit synthesis and transpiling with Reinforcement Learning},
Year = {2024},
Eprint = {arXiv:2405.13196},
}
Next steps
- Learn how to create AI transpiler passes.
- Learn how to transpile circuits(opens in a new tab) as part of Qiskit Patterns workflows using Qiskit Runtime.
- Review the Qiskit transpiler service API documentation.(opens in a new tab)