Pattern Atlas

Extended Quantum Computing Patterns

Dynamic Circuit

Aliases:

Tags:

© This pattern is originally published in L. Stiliadou, J. Barzen, M. Beisel, F. Leymann, and B. Weder, "Fundamental Patterns for Quantum Algorithms", in Proceedings of the 1st International Conference on Quantum Software (IQSOFT), Xpert Publishing Services (XPS), 2025.

Intent

How to modify a quantum computation during runtime based on intermediate information about a part of the quantum state?

Context

A quantum circuit must be modified based on intermediate information about a part of the quantum state.

Forces

Measuring a qubit causes its state to collapse and breaks the entanglement between the measured qubit and the entangled qubits. Operations between qubits that are far apart from each other require a lot of intermediate SWAP operations, increasing the depth of the circuit. The low decoherence times of current quantum devices limit the maximum execution time of quantum circuits.

Solution

To modify a quantum computation during runtime based on intermediate information about a part of the quantum state, define a dynamic quantum circuit that utilizes mid-circuit measurements as well as classical processing. Classical processing can either be a feedforward of the measurement results or a more complex computation that utilizes the measurement results to adaptively apply or skip specific quantum operations.

Solution sketch dynamic circuit

The sketch exemplarily showcases a dynamic circuit using feedforward: First, the quantum circuit performs a sequence of operations. Then, a mid-circuit measurement is performed on the first qubit and the measurement result is used for classical processing. Based on the outcome of the classical processing, it is determined if the gate \(U_1\) or \(U_2\) shall be applied. If the outcome of the classical processing is 1, then \(U_1\) is applied; if it is 0, then \(U_2\) is applied.

Result

Dynamic circuits enable the development of algorithms and optimization routines that require intermediate information about a part of the quantum state. The classical processing performed after the mid-circuit measurement must be faster than the decoherence time of the quantum device so that the quantum state is not lost before the quantum computation can be modified and completed. Additionally, feedforward of measurement results leads to constant latency for executing conditional operations, while more complex real-time computations introduce additional variable delays depending on their complexity [Gupta et al., 2024].

Related Patterns

The MID-CIRCUIT MEASUREMENT pattern is used to extract intermediate information about the quantum states during runtime. Dynamic circuits can be utilized with the INITIALIZATION pattern [Leymann, 2019] to reduce the depth of the quantum circuits. Combining the CIRCUIT CUTTING pattern [Bechtold et al., 2023] and the DYNAMIC CIRCUIT pattern can reduce the number of cuts required to split a quantum circuit [Pawar et al., 2023]. Further, dynamic circuits can be used as ansatzes for the VARIATIONAL QUANTUM ALGORITHM pattern [Weigold et al., 2021] as they are free of barren plateaus [Deshpande et al., 2024].

Known Uses

Dynamic circuits can be incorporated into error correction techniques to reduce errors accumulated during the quantum computation [Niu et al., 2024]. Another application area is to reduce the depth of QFT circuits by utilizing dynamic circuits [Bäumer et al., 2024a]. Distant qubits can be entangled using dynamic circuits, drastically reducing the number of required SWAP operations and, therefore, the depth of the quantum circuit [Bäumer et al., 2024b].