# Mid-circuit Measurement

Mid-Circuit Measurement refers to the practice of performing measurements on qubits at intermediate stages within a quantum circuit, rather than only at the end. This technique allows for conditional operations based on the measurement outcomes and can introduce new capabilities and efficiencies in quantum algorithms. However, it also adds complexity to both the design and execution of quantum circuits.

In a typical quantum circuit, measurements are performed at the end to extract the final result. With Mid-Circuit Measurement, measurements are made on selected qubits during the computation. These measurements collapse the qubits into definite states, and the outcomes can be used to control subsequent operations. For example, a measurement outcome might determine whether a particular gate is applied to another qubit, leading to conditional execution within the quantum circuit.

Mid-Circuit Measurements can be used to optimize algorithms, reduce the number of required qubits, and enable new types of computations. They are essential in certain error correction schemes and can be used to implement quantum repeaters in quantum communication. By allowing for adaptive computations, where the algorithm's path depends on intermediate results, Mid-Circuit Measurements can make quantum computations more flexible and powerful.

Implementing Mid-Circuit Measurements presents challenges, particularly in error-prone Noisy Intermediate-Scale Quantum (NISQ) devices. The act of measurement introduces additional opportunities for error and can lead to complications in error correction. Careful design and calibration are required to ensure that the benefits of Mid-Circuit Measurements are realized without introducing unacceptable levels of noise and error.

Mid-Circuit Measurement represents an advanced technique in quantum computing, expanding the computational toolkit and enabling more sophisticated algorithms. It's an area of ongoing research and development, with potential to enhance the capabilities of both near-term and future quantum computing systems.

## What is Mid-Circuit Measurement?

The first three principles a quantum computer user learns are superposition, entanglement, and quantum circuit measurement. This can all be covered with a simple Bell State measurement, which measures the qubits at the end of the circuit. In fact, from the beginning, measurement in quantum computing could only be performed at the ends of circuits. Recently, however, mid circuit measurement has begun to become available. The simplest possible definition is that a mid-circuit measurement is any measurement that executes before the end of the circuit.

For a deeper understanding, check out the paper “Characterizing mid-circuit measurements on a superconducting qubit using gate set tomography” by a team from the Quantum Performance Laboratory of Sandia National Laboratories and Quantum Engineering and Computing of Raytheon BBN Technologies. And for a practical application, check out the paper “Error mitigation for variational quantum algorithms through mid-circuit measurements” by a team from the Polish Academy of Sciences, Wigner Research Centre for Physics, BME-MTA Lend¨ulet Quantum Information Theory Research Group, QWorld Association, and the Silesian University of Technology.

## How Mid-Circuit Measurement Works?

A “Qubit” has historically been measured at the end of the quantum circuit. The results are returned to a classical computer, where it is then subjected to classical post-processing. Alternately, it is subjected to classical mid-processing, and then a new quantum circuit is queued up for execution. These iterative algorithms are particularly slow, even with dedicated access to a quantum computer. Each circuit has a minimum runtime, which is then multiplied by the number of iterations. Add queues, multiply them by the number of iterations, and runtimes can extend into hours, days, or worse.

Mid-circuit measurements introduce classical logic next to quantum processors. The classical mid-processing, to the extent the hardware and control systems can support it, can now be executed during the runtime of one circuit. A measurement is taken as it as always been taken, but the circuit doesn’t terminate. Classical logic is applied immediately and execution continues.

## Applications of Mid-Circuit Measurement

Mid-circuit measurements have quite a few applications in quantum computing. The concept is still relatively new, so this list can be expected to grow over time:

- Minimizing the duration qubits need to maintain their coherence by bringing initialization and measurement closer together
- Minimizing decoherence by measuring qubits as soon as they’re done, not making them wait until all qubits are done
- Detecting and correcting errors in real-time during execution through the mid measurement of stabilizer qubits
- Evolving quantum states by applying operations conditional on the states of other qubits, and without creating unwanted entanglement between those qubits
- Removing certain quantum operations from algorithms that can be replaced with classical logic, potentially shallowing quantum circuits
- Updating parameters within the parameterized circuits of variational quantum algorithms without leaving the quantum processor, a potentially significant time savings
- Measuring, resetting, and reusing qubits during a time when qubits are still in relatively short supply

The big caveat with mid-circuit measurements, is that measurement might be the slowest operation a quantum computer can execute. The classical operations that are conditional on those measurements, whether used for error correction or for other purposes, are also relatively slow. This means that the measurements may introduce errors, the conditional operations may introduce errors, and other qubits in the circuit may experience errors while waiting for these slow classical operations to execute. An advantage, however, is that quantum information is not destroyed, as it would be if the circuit had to terminate. The qubits that are not measured need error suppression, but they retain their quantum information while waiting for these classical operations to execute.