2.3. Rise of hybrid quantum-classical computation
Quantum measurements #
Until now, we have skipped over a crucial part of the quantum computation process: the role of quantum measurements. Quantum data, in isolation, is inherently inaccessible to humans: we cannot consume it! A result from a quantum computation is only of value if we can probe it and get some readout value that we can display to the user or return to whomever launched the quantum computation.
Measurements in quantum physics are fundamentally different from our classical understanding of just “reading out” data that is already there. This is the famous Schrödinger’s cat thought experiment of quantum mechanics: what data is within the qubits remains undefined until a measurement is performed. The act of observation will transform the quantum data: looking inside the proverbial box will at random either kill the cat or spare it.
We thus need to add the measurement operation as a special case to our computer scientist’s model of quantum computing. Unlike purely quantum operations, measurements inherently involve interaction with the environment to produce a readout. Consequently, the no-delete and reversibility principles discussed earlier do not apply. Indeed, measurement is a lossy (and therefore irreversible) operation that project the quantum state into one of a small subset of classical states. Which state the quantum state is projected into is non-deterministic. If one has access to an infinite supply of the same quantum state, then the full state can be eventually reconstructed by repeating measurements and analysing the distribution of outcomes1. Given no-cloning, however, this is unlikely to be the case, and so the full quantum result is hardly ever known. We must instead rely on well-designed measurement schemes to extract useful information from the partial access we have to the quantum states.
We model measurement as an operation that takes one qubit and outputs one purely classical bit2. In the circuit formalism, measurements are often implicitly added at the end of every qubit. If we wish to make them explicit or add them elsewhere in the computation, we must introduce a graphical representation for the classical bit of data that is produced by the measurement. The field has adopted the double wire for this (SVG db-wire), even though a “half” wire would arguably have been more appropriate to reflect the reduced information density relative to quantum wires. Ladies and gentlemen, I present to you, the measurement box:
Measurements as first class citizens #
It is very tempting to our feeble classical brains – and admittedly we just did it ourselves in the previous paragraphs – to view measurements as merely a readout operation; an auxiliary operation that we are forced to perform at the end of a computation for operative reasons. This could not be further from the truth! In many ways, measurements are just as powerful tools as any other quantum operation – if not more so!
One eye-opening perspective on this is the field of measurement-based quantum computing (MBQC). Raussendorf and Briegel showed indeed Rausse., 2001. 2001. A One-Way Quantum Computer. Physical Review Letters 86, 22 (May 2001, 5188--5191). doi: 10.1103/PhysRevLett.86.5188 that arbitrary quantum computations can be reproduced in the MBQC framework using only some resource quantum states that can be prepared ahead of time and measurements! In other words, given entangled qubits, measurements are all you need to perform quantum operations.
We will not explore MBQC further in this chapter (nor in this thesis, for that matter) – rather we will use this as a motivation to explore further what we can achieve with measurements. We have so far spared you from any mathematical alphabet soup. As we start discussing more concrete constructions of quantum computations, some basic linear algebra and conventions around notation will become unavoidable.
Dirac formalism. Quantum states are nearly unanimously written using kets: instead of referring to a quantum state as , we write it wrapped in special brackets as . This notation is also used when referring to the 0 and 1 states of qubits, written and .
Several states can be joined and considered together, as one overall state. This is expressed using the tensor symbol: is the joint system of and . When the states in question are all explicitly qubit states, we use the shorthand binary notation .
We will introduce more notation along the way.
With this out of the way, let us look in more details at the first smart use of measurements: the block-encoding technique. Consider the following scenario: you would like to perform an operation on an arbitrary quantum state . Now, there are unfortunately many cases where implementing as a quantum circuit made of primitive gates that can be executed on hardware is very expensive3.
However, what we can always do is express as a matrix of dimensions , where is the number of qubits in the state . Then, there is a neat trick that we can sometimes apply: instead of trying to execute , we enlarge the matrix to a bigger :
Let us take a look at the quantum states that result from executing . If we add to a ancilla state, our quantum operation acts as4
How can we recover from (*)? This is precisely what measurements do! When quantum states are expressed as sum of states, the terms of the sum form the possible measurement outcomes5. If we only measure a subset of the qubits, then the term corresponding to that measurement is isolated and all other terms disappear. Hence, if we measure the first qubit (that we introduced ourselves) in the zero state, then the remaining qubits will be precisely in the desired state . Success!
Using this “term isolating” property of measurements, known as state collapse, we can thus effect computations that would have been otherwise difficult or impossible to perform. There is however one important wrinkle that we cannot forget about: measurements are non-deterministic! We cannot assume that all measurements of the ancilla qubit will return the zero state. When is measured on the ancilla, the remaining qubits are left in the state. The computation has thus failed, and the execution must be aborted and restarted. How often the block-encoding protocol that we have presented fails depends on the details of and the choices of and and is the main disadvantage of an otherwise very powerful quantum technique.
We will now explore two strategies to deal with “fails” in measurements. At the core of them is the idea of hybrid quantum-classical programs.
SOTA: LCU, QSVT, etc.
Who said quantum computers could not fix their mistakes #
Failed computations are an expensive mistake in quantum computing as the no-cloning theorem prevents us from keeping a “backup” of the initial state. The fact that failures are in fact unlucky measurement outputs makes matters worse, given that measurements are the only irreversible quantum operation. It is therefore impossible in general to recover from a “wrong” measurement.
There are, however, prominent cases in which the computation can be corrected based on the measurement outcome, thus yielding deterministic results. Recall the general framework we introduced in the previous section: there is a computation on qubits, that can be probabilistically computed using qubits using :
1 was measured on the ancilla qubit6!
This is the beginning of quantum-classical hybrid computing: we start by performing quantum operations followed by measurements, the outcomes of which dictate what further quantum operations must be applied. We define the classically controlled gate, a quantum operation that is only executed if a certain classical bit (the condition) is set. This bit will typically be a value derived from a previous measurement: it could be as simple as the outcome that a previous measurement yield, or a function of multiple past outcomes that must be evaluated on classical hardware (e.g. a CPU).
Mixing classical and quantum operations is a sure way to bring the quantum circuit representation to its knees. In this thesis, we adopt the following interactive representation to show the circuit and classically controlled operations that result from various measurement outcomes.
0 and 1,
and the corresponding classically controlled operations.
Quantum Teleportation #
Quantum teleportation is a beautifully simple example of performing classically controlled quantum operation to perform corrections in the circuit based on measurement outcomes. It is also coincidentally one of the most fundamental protocols of quantum theory. Its name is slightly misleading. Think of it as data transfer for quantum data, with a slightly mind bending twist: at the time of the transfer, only classical data must be communicated between the sending and receiving parties. As a result of this protocol, quantum information can be transfered using plain old school copper wires (or any other classical communication channels)!
This is predicated on one crucial action being performed before the
start of the communication: for every qubit that should be transmitted, the
parties must beforehand create and share among themselves a pair of qubits
that will serve as the quantum resource during the protocol execution.
This resource state is widespread enough that it
got its own name, the Bell pair state.
It is written in Dirac notation as .
As the notation indicates, it as a state with perfectly correlated measurements:
when measured, the two qubits will always yield the same outcome, either both
0 or both 1.
There turns out to be a very simple circuit that maps the two-qubit , which every computation starts in, into the Bell pair state:
We are interested in “teleporting” an arbitrary, single-qubit quantum state.
Such a state can always be expressed as
, i.e. in the most general case,
a one-qubit state will be in some superposition of the states
and .
The paramenters and are complex coefficients that encode the
probabilities of measuring 0 or 1 – we can view them as the weights of a
weighted sum.
We are now interested in combining a Bell resource state in a joint system with the arbitrary state . The resulting three-qubit state is obtained with the operation, which distributes over sums just like usual multiplication:
00
(corresponding to the state ),
but as it stands, this only has a probability of success.
You might notice, however, that the other states the first qubit can end up in look remarkably similar, up to some sign flips and swaps . In particular, all states still have the amplitudes and somewhere, so it does not seem unfathomable that these “wrong” states can be mapped back to .
We can use the measurement outcomes of the second and third qubit to infer
which of the “mistakes” occurred, and hence what state the first qubit has
ended in.
The 01 measurement outcome, for instance, results in the
state – this is just a bit flip away from
!
This gate is known as .
Its colleague the gate on the other hand leaves states untouched
but flips the sign of .
This would fix the 10 outcome. Finally, 11 requires both a Z and a X
correction.
Putting these observations together, we can leverage classically controlled operations to obtain a protocol that is fully deterministic! The correct circuit implementating quantum teleportation is given by
It is beautiful and often overlooked how one of the most fundamental protocols of quantum information theory is in fact a hybrid classical-quantum computation. Quantum teleportation without classical communication is physically impossible: it would let Aice communicate with Bob instantly, even as he could be light years away – in other words, it would fundamentally break relatively.
Repeat until success: If you fail, retry! #
Classical computer science has a very simple solution whenever probabilistic computations that can fail are used: probability amplification, or boosting Scheid., 2018. 2018. Probability amplification. Retrieved lecture notes, online, visited 30/12/2024 from https://cs.uni-paderborn.de/fileadmin-eim/informatik/fg/ti/Lehre/SS_2018/AA/lecture_5.pdf. The idea is so simple that it barely deserves a name: execute several independent runs of the computation and choose the most common outcome. If the probability of failure is below a certain threshold (e.g. 50% for a binary output), then with basic statistics one can extrapolate the number of runs required to obtain any desired accuracy8.
We have been ignoring this approach so far, since no-cloning prohibits us from repeating a procedure more than once on an input state . However, in the scenario that the computation should only be executed on a specific, known input state and the computation that prepares that state is known, then we can recover from computation failures, by just prepare a new state identically.
Suppose we know how to execute the quantum computation
mapping .
As before, we would like to compute given an implementation of
the computation that acts on and an ancilla qubit in the
state.
If the measurement of returns 1, then
the computation failed.
We can then discard all qubits and restart from the state, applying
followed by and an ancilla measurement, repeating until we
measure 0. As a pseudo-quantum circuit, we could express this as:
But pseudo circuits do not run on hardware! The only way to express this
computation as an actual circuit is to set a max_iter constant and to repeat
the block within the loop that many times
(here max_iter=3 – expand the boxes at your own risk):
The resulting program is not only hard to display and read, it also suffers from real issues in practice. For one, the program size becomes extremely bloated and beyond just slowing down the compiler, it will also cause a host of issues on the control hardware in real time, such as long load times, inefficient execution and low cache efficiency.
Even more worryingly, when picking max_iter we are faced with an impossible
tradeoff:
if max_iter is small, then the probability of failure will remain
non-negligible. As we scale this value up, however, we are introducing more
and more gates into the program to cover the odd case of
mutliple successive repeated failures. These are gates that we do not
intend to execute on most runs of the computation, yet come at a significant
cost to the runtime: for each gate listed in the circuit, the condition for the
gate’s execution must be checked, whether or not the gate ends up being
executed. Furthermore, hardware schedulers might be forced to be pessimistic
and schedule a time window for all conditional operations ahead of time.
This will significantly delay any operation to be performed after the loop.
We therefore argue that the quantum circuit model is ill-suited as the representation for quantum programs that combine classical and quantum data. Such programs, however, are a fundamental building block towards developing meaningful large scale quantum computations and are bound to become the norm. Beyond the examples that we touched on in the above paragraphs, which included block-encodings, repeat-until-success schemes, distributed quantum computing and measurement-based quantum computing, a major application of measurement-dependent classical operations in the coming years will be the implementation of quantum error correction (QEC) schemes. It is widely agreed that QEC will be critical to the large scale deployment of quantum computing – now is the time to build the tooling that will support these use cases.
-
This is known as state tomography Allahv., 2004. 2004. Determining a Quantum State by Means of a Single Apparatus. Physical Review Letters 92, 12 (March 2004, 120402). doi: 10.1103/PhysRevLett.92.120402. You will need to perform measurements in more than one basis, i.e. different choices of classical states to project to. ↩︎
-
Where did the qubit go? It turns out that all the information that is contained in a qubit post measurement is also contained in the classical bit of output data – it is therefore redundant and renders the qubit useless. In our model wee therefore bundle measurement and qubit discard into one operation. ↩︎
-
or outright impossible, in cases where is not a unitary linear operation, for example. ↩︎
-
This is obtained by a simple matrix multiplication. The vector representation of the quantum state is obtained using the Kronecker product. You can also just trust me that this works out this way :) ↩︎
-
This is simplifying slightly. There is a necessary condition for this to be a valid measurement: the states in the sum must form a measurement basis, i.e. they must be orthogonal. This is satisfied here. ↩︎
-
Notice that, informally, we would hope to get a computation such that in the sense that it should somehow be closely related to . This way, the resulting correction would be close to the identity, and would be cheap to compute. ↩︎
-
Apologies, it seems at this point that we are conjuring up a complex expression out of nowhere. It is in fact just a change of basis – plain old linear algebra. The formula can be obtained easily by writing out the basis change matrix. ↩︎
-
This is fiendishly effective: the Hoeffding bounds guarantee that the probability of success will converge to 1 exponentially with the number of runs. ↩︎