Skip to content

Synthesis Preferences

You can modify these synthesis process preferences:

In the example below, the chosen output format includes both Q# and OpenQASM. In addition, specific basis gates were selected for the synthesis: controlled not, controlled phase, square root of not, Z-rotation, and not gates.

  "logic_flow": [{
      "function": "StatePreparation",
      "function_params": {
        "probabilities": [0.5, 0.1, 0.2, 0.005, 0.015, 0.12, 0.035, 0.025],
        "error_metric": { "KL": { "upper_bound": 0.3 }}
      "outputs": "sp_out"
      "function": "QFT",
      "function_params": {
        "num_qubits": 3
      "inputs": "sp_out"
  "preferences": {
    "output_format": ["qs", "qasm"],
      "basis_gates":["cx", "cp", "sx", "rz", "x"]
from classiq import Model

from classiq.model import (
from classiq.builtin_functions.state_preparation import Metrics
from classiq.builtin_functions.range_types import NonNegativeFloatRange

from classiq.builtin_functions import QFT, StatePreparation

custom_hardware_settings = CustomHardwareSettings(
    basis_gates=["cx", "cp", "sx", "rz", "x"]
preferences = Preferences(
    output_format=["qasm", "qs"], custom_hardware_settings=custom_hardware_settings
model = Model(preferences=preferences)

num_qubits = 3

probabilities = (0.5, 0.1, 0.2, 0.005, 0.015, 0.12, 0.035, 0.025)
sp_params = StatePreparation(
    error_metric={Metrics.KL: NonNegativeFloatRange(upper_bound=0.3)},
x = model.StatePreparation(sp_params)["OUT"]

qft_params = QFT(num_qubits=num_qubits)
model.QFT(qft_params, in_wires=x)

circuit = model.synthesize()

Output Formats

The Classiq platform provides different ways to format the output of generated circuits. You can choose multiple output formats.

The output options:

  • "qasm" - OpenQASM
    • By default, the Classiq platform uses OpenQASM 2.0. To use OpenQASM 3.0 instead, set the qasm3 field of the preferences to True.
  • "qs" - Q#
  • "ll" - Microsoft's QIR
  • "ionq" - IonQ Json format
  • "cirq_json" - Cirq Json format
  • "qasm_cirq_compatible" - OpenQASM 2.0 compatible for Cirq.


The Classiq platform offers two timeouts: the generation timeout and the optimization timeout. Both timeouts are specified in a whole number of seconds.

The generation timeout, timeout_seconds, governs the entire synthesis process.

Amongst other tasks, the synthesis engine performs optimization (see Optimization Parameter), which may take a long time to complete. Therefore, to limit the amount of time the engine spends optimizing, set optimization_timeout_seconds. If no optimization occurs (for example, if you did not specify an optimization parameter), this timeout has no effect.

When the optimization timeout is reached, the synthesis engine returns the best solution found so far. If the engine does not find a solution within that time, it issues a message.

You can specify both timeouts. Just make sure that the optimization timeout is smaller than the generation timeout.