Learning parity with noise¶
Imagine you discover an alien artifact. It has a single button on it which you can push. Every time you push the button the artifact emits qubits. A scientist who does not know any quantum mechanics determines that (to him) the bits emitted have a specific form. The first bits are completely random.
The final bit is determined by where is an -bit string which he does not yet know. means the inner product between and defined as where and are the and . We say that the artifact is an example oracle for the parity function. The goal in this example is to learn the value of . The classical scientist can do this by obtaining just a few more than examples from the oracle. To see this, imagine the scientist got lucky and read out a string like . The bit to the right of the is the special “last” bit. This then immediately tells him that the 5th bit of is 1. If the last bit had been 0, you would know that the 5th bit of was 0. Now, because the whole problem is linear, any example yields one bit of information about . Each additional example will yield another bit of information about , provided it is linearly independent of the previous examples. For instance, if you get the same bitstring out of the oracle that you have seen before, it obviously doesn’t teach you anything new. Actually calculating can be done efficiently from the examples using Gaussian elimination.
Unlike the classical scientist, we know quantum mechanics. The state that actually emerges from the oracle is . If we were to measure in the computation basis, this would result in the distribution seen classically. But if we simply apply the Hadamard gate to all the qubits, the resulting state is . Thus, if we measure the first bits, we can just read out the value of half the time! Furthermore, the state of the last bit tells us whether to expect to read out or . So we need only queries and no special Gaussian elimination classical computation at the end!
That’s already a pretty stark difference between the classical and quantum case. In fact, this is the example oracle version of the Bernstein-Vazirani algorithm, itself a refinement of the Deutsch-Jozsa algorithm found earlier in the tutorial. But when the oracle is noisy, as all practical systems are, the difference becomes even stranger. Usually, noise makes things worse for quantum computers much more than for their classical counterparts. In this problem, the noise makes things much worse for the classical scientist, but not so much for us quantum scientists. The problem for the classical scientist is that when some of the bits are wrong, the Gaussian elimination algorithm no longer works. The problem becomes equivalent to the problem of decoding a random linear code, which is believed to be outside of P. The best known algorithm becomes computationally intractable for a few hundred bits. This is true even for relatively tiny amounts of noise. The quantum scientist can just carry on as before, needing just a few more examples from the oracle. Provided the noise isn’t too large, each bit of the output is still correct more than half the time. By keeping track of the results for each bit separately and using whichever result (0 or 1) is most common for each bit, the correct answer can be determined in a straightforward manner. Implementing this algorithm is simple. Making a parity oracle on our quantum computer is very easy, requiring only CNOT gates, and the learning algorithm requires only Hadamards and measurements.
See if you can determine the hidden value of in the following circuit. Note that the special “last” bit is in the middle due to the limitations of our current actual architecture. The example oracle is everything up to the final set of Hadamard gates, which themselves are the quantum algorithm.
LPN circuit 2