Pattern Atlas

Extended Quantum Computing Patterns

Mid-Circuit Measurement

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 extract partial information from a quantum device while a circuit execution is still running?

Context

During the execution of a quantum circuit, intermediate results, i.e., information about the state of one or multiple qubits, should be extracted before the circuit execution finally terminates.

Forces

As quantum devices only provide a limited number of qubits, these qubits must be utilized efficiently, e.g., by reusing ancilla qubits that are no longer required. When measuring a qubit that is entangled with other qubits, the measurement does not only collapse the state of the measured qubit but also irreversibly impacts the quantum states of the entangled qubits.

Solution

Incorporate so-called mid-circuit measurements into the quantum circuit, i.e., measurements before the quantum circuit execution terminates. Solution sketch mid-circuit measurement As illustrated in the sketch, various quantum operations are performed on different qubits initialized in the \(\ket{0}\) state, resulting in an intermediate quantum state. A subset of \(m\) qubits is then measured, yielding a measurement outcome \(s \in \{0,1\}^{\otimes m}\), extracting classical information about a part of this intermediate quantum state. Afterwards, the execution of the quantum circuit continues. For example, in the sketch a mid-circuit measurement is performed on the last qubit, measuring a classical 0 and collapsing the state of the qubit into the \(\ket{0}\) state.

Result

Mid-circuit measurements provide information about the intermediate states of the measured qubits. Each measured qubit collapses into the state \(\ket{0}\) or \(\ket{1}\), which can, e.g., be used to reset them by applying a controlled X operation after the measurement [Xu et al., 2023]. After resetting the qubits, they can be reused for further computations. By performing mid-circuit measurements on a qubit, the states of qubits that are entangled with the measured qubit are influenced. The states of qubits that are not entangled with the measured qubits are preserved.

Related Patterns

The DYNAMIC CIRCUIT pattern uses the MID-CIRCUIT MEASUREMENT pattern to retrieve intermediate information for dynamically modifying quantum computations during runtime.

Known Uses

Mid-circuit measurements can be used to reset a qubit conditionally [Koh et al., 2024]. [Govia et al., 2023] analyze how mid-circuit measurements affect the states of topologically connected qubits. [Smith et al., 2024] present a constant-depth state preparation of matrix product states using mid-circuit measurements and feedforward operations.