I have a 3-qubit unitary represented by a circuit with the following dictionary: {'cx': 30, 'h': 22, 'rz': 15, 's': 4, 'sdg': 4}. I want to use this circuit on IBM machine with a pre-defined coupling map. However, the transpiled circuit with a map i.e.,

transpiled_circuit = transpile(circuit, basis_gates=['rz', 's', 'sdg', 'h', 'cx'], coupling_map=[[0, 1], [1, 2]], optimization_level=3)

is very different from the initial circuit which is incorrect. What am I doing wrong?


1 Answer 1


It is hard to know without a specific example. However, here is my take on it:

Optimization level 3 does resynthesis for optimization and reshuffles gates to not just only make it fit into the coupling map, but reduce depth and, ultimately, improve fidelity. It is kind of aggressive doing that and maybe it messes with your basis. Try optimization_level=0. It will do the minimum to fit your circuit in the coupling map.

  • $\begingroup$ Unfortunately, I did try that before posting as well and it didn't help. I will add a comment/answer when I resolve it. I should also add that I do original circuit $n$ times and transpiled circuit $n$ times where $n<10$. The Trotter evolution of both are very different and therefore the overlap with the same initial state is different. $\endgroup$
    – R.G.J
    Commented Oct 27, 2023 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.