Skip to main content
Transpilation is the process of optimizing an already-synthesized quantum program and matching it to the desired hardware. It includes optimizations, such as combining a sequence of gates into an equivalent single gate; and transformations, such as qubit routing (i.e., using swap gates to apply 2-qubit gates on partially connected hardware). Classiq synthesis returns an execution-ready quantum program. It contains a description, in a restricted subset of Qmod, that defines the concrete implementation of high-level constructs and folds in all resource-allocation decisions. This description preserves the function hierarchy and symbolic control flow of the Qmod source and can be displayed via the QP visualizer. However, it is not yet transpiled to a specific backend’s gate set or connectivity. Transpilation happens later, only when a concrete circuit is needed: when you export the program to a supported target language, when you request its transpiled metrics with get_transpiled_circuit_metrics, or when you execute it on a designated backend, where the Classiq execution service transpiles it for that hardware so that every gate is compatible.
To restore the legacy flow, in which transpilation runs during synthesis, set compatibility_mode=True in Preferences.
If you set preferences in the synthesis step, for example a transpilation option or a target backend in the synthesis Preferences, they are saved with the quantum program and applied when you export it (by setting transpilation_config=True) or read its transpiled metrics. To use a different transpilation option on export, pass an explicit TranspilationConfig instead of True; this overrides the synthesis settings entirely. Execution, on the other hand, disregards the synthesis transpilation option and transpiles for whichever backend you run on, at the decompose transpilation option by default. See execution preferences for the options available at execution.

Transpilation Options

  • none: no transpilation. This is the default transpilation option of export if no transpilation_config is passed.
  • decompose: decompose all of the functions according to the basis gates of the backend.
  • light: the lightest optimization pass; fast, and best suited for fully connected hardware.
  • medium: a heavier pass that optimizes the quantum program further, at the cost of longer runtime. A balanced choice for hardware with moderate connectivity.
  • auto optimize: chooses the transpilation automatically between light and medium, based on the chosen backend. This is the default transpilation option in get_transpiled_circuit_metrics and in export(..., transpilation_config=True) when no transpilation option is set as a preference at synthesis.
  • intensive: the heaviest pass, for maximum optimization. Well-suited for hardware with complex connectivity.
  • custom: offers a personalized approach to optimizing quantum programs while weighing various factors. It takes specific optimization criteria into account, transpiling the quantum program to maximize efficiency and resource utilization for the chosen backend, with a primary focus on delivering the best possible circuit performance.
The heavier the transpilation option, the better the quantum program is optimized, but transpilation takes longer.