First, let me say that I am not familiar with the idea of Dynamical Decoupling. The goal of this question is to understand how to set up a circuit with dynamical decoupling to improve my hardware result.
Due to the interaction with the environment, the dynamics of an open quantum system is not unitary. Thus, dynamical decoupling is about an open loop control technique for cancellation of the environment noise.
In the Dynamical coupling technique, a series if strong fast pulses are applied on the system which on average neutralizes the system-bath coupling, decouple system from bath (environment).
For instance, given the original circuit as:
you instead perform the following:
This can be done as shown in this Qiskit's documentation:
import numpy as np
from qiskit.circuit import QuantumCircuit
from qiskit.circuit.library import XGate
from qiskit.transpiler import PassManager, InstructionDurations
from qiskit.transpiler.passes import ALAPSchedule, DynamicalDecoupling
from qiskit.visualization import timeline_drawer
circ = QuantumCircuit(4)
circ.h(0)
circ.cx(0, 1)
circ.cx(1, 2)
circ.cx(2, 3)
circ.measure_all()
durations = InstructionDurations(
[("h", 0, 50), ("cx", [0, 1], 700), ("reset", None, 10),
("cx", [1, 2], 200), ("cx", [2, 3], 300),
("x", None, 50), ("measure", None, 1000)]
)
# balanced X-X sequence on all qubits
dd_sequence = [XGate(), XGate()]
pm = PassManager([ALAPSchedule(durations),
DynamicalDecoupling(durations, dd_sequence)])
circ_dd = pm.run(circ)
timeline_drawer(circ_dd)
Now you can varies the durations parameters to change the length of the gate, and also you can change the number of $X$ gates in the sequence you can apply to each qubit in the circuit (the above circuit has the same number of $X$ gates on both qubits $q_0$ and $q_1$ but this doesn't have to be the case).
As you can see, with the example given above, the first $CX$ was set at $700 \ dt$ , the second $CX$ was set at $200 \ dt$, and then the last $CX$ was set at $300 \ dt$. How were these specific numbers picked?
I also want to mention something else. The Dynamical_Decoupling circuit (the bottom circuit) upon execution didn't give me an improved results!
I have tried different combinations as well, by setting longer or shorter $dt$ for different $CX$ gates, add more number of $X$ gates to the qubits that need to be idle longer, etc. But similarly, when I compare such circuit results to the original circuit (the circuit without performing Dynamical Decoupling) results, they were not better.