The Alien Cookbook

An alien looking on distraught that two bowls of soup are different, one purple, one green.
Image by CS4FN from original soup bowls by OpenClipart-Vectors and alien image by Clker-Free-Vector-Images from Pixabay

How to spot a bad chef when you’ve never tasted the food (OR How to spot a bad quantum simulator when you do not know what the quantum circuit it is simulating is supposed to do.)

Imagine you’re a judge on a wild cooking competition. The contestants are two of the best chefs in the world, Chef Qiskit and Chef Cirq. Today’s challenge is a strange one. You hand them both a mysterious, ancient cookbook found in a crashed spaceship. The recipe you’ve chosen is called “Glorp Soup”. The instructions are very precise and scientific: “… Heat pan to 451 degrees. Stir counter-clockwise for exactly 18.7 seconds. … Add exactly 3 grams of powdered meteorite (with the specified composition). …” The recipe is a perfectly clear algorithm, but since no human has ever made Glorp Soup, nobody knows what it’s supposed to taste, look, or smell like. Both chefs go to their identical kitchens with the exact same alien ingredients. After an hour, they present their dishes.

  • Chef Qiskit brings out a bowl of thick, bubbling, bright purple soup that smells like cinnamon.
  • Chef Cirq brings out a bowl of thin, clear, green soup that smells like lemons.

Now you have a fascinating situation. You have no idea which one is the “real” Glorp Soup. Maybe it’s supposed to be purple, or maybe it’s green. But you have just learned something incredibly important: at least one of your expert chefs made a mistake. They were given the exact same, precise recipe, but they produced two completely different results. You’ve found a flaw in one of their processes without ever knowing the correct answer.

This powerful idea is called Differential Testing.

Cooking with Quantum Rules

In our research, the “alien recipes” we use are called quantum circuits. These are the step-by-step instructions for a quantum computer. And the “chefs” are incredibly complex computer programs called quantum simulators, built by places like Google and IBM.

Scientists give these simulators a recipe (a circuit) to predict what a real quantum computer will cook up. These “dishes” could be the design for a new medicine or a new type of battery. If the simulator-chef gets the recipe wrong, the final result could be useless or even dangerous. But how do you check a chef’s work when the recipe is for a food you’ve never tasted? How do you test a quantum simulator when you do not know exactly what a quantum circuit should do.

FuzzQ: The Robot Quantum Food Critic

We can’t just try one recipe, one quantum circuit. We need to try thousands. So we built a robot “quantum food critic”, a program we call FuzzQ. FuzzQ’s job is to invent new “alien recipes” ie quantum circuits and see if the two “chefs” cook the same dish (i.e. different simulators do the same thing when simulating it). This process of trying out thousands of different, and sometimes very weird, recipes is called Fuzzing.

Here’s how our quantum circuit food critic works:

  1. It writes a recipe: FuzzQ uses a rulebook for “alien cooking” to invent a new, unique, and often very strange quantum circuit.
  2. It gives the recipe to both chefs: It sends the exact same quantum circuit to “Chef Qiskit” (the Qiskit simulator) and “Chef Cirq” (the Cirq simulator).
  3. It tastes the soup: FuzzQ looks at the final result from both. If they’re identical, it assumes they’re correct. But if they do different things, so one did the equivalent of make a purple, bubbling soup and the other made the equivalent of a clear, green soup, FuzzQ sounds the alarm. It has found a bug!

We had FuzzQ invent and “taste-test”, so check the results of, over 800,000 different quantum recipes.

The Tale of the Two Ovens 

Our robot critic found 8 major types of quantum “cooking” errors. One of the most interesting was for a simple instruction called a “SWAP”, which was discovered by looking at how the two chefs used their high-tech “ovens”.

Imagine both chefs have an identical oven with two compartments, a Top Oven and a Bottom Oven. They preheat them according to the recipe: the Top Oven to a very hot 250°C, and the Bottom Oven to a low 100°C. The recipe then has a smart-oven command:

 “Logically SWAP the Top Oven and Bottom Oven.”

Both chefs press the button to do the “SWAP”.

  • Chef Cirq’s oven works as expected. It starts the long process of cooling the top oven and heating the bottom one.
  • Chef Qiskit’s oven, however, is a “smarter” model. It takes a shortcut. It doesn’t change the temperatures at all but just swaps the labels on its digital display so that the one at the top previously labelled the Top Oven is now labelled as the Bottom Oven, and vice versa. The screen now lies, showing Top Oven: 100°C and Bottom Oven: 250°C, even though the physical reality is the opposite: the one at the top is still the incredibly hot, 250°C and the one below it is still 100°C.

The final instruction is: 

“Place the delicate soufflé into the physical TOP OVEN.”

  • Chef Cirq opens his top oven (ie the one positioned above the other and labelled Top Oven), which is now correctly at 100°C, having cooled down, and bakes a perfect soufflé.
  • Chef Qiskit, trusting his display, opens his top oven (ie the one positioned above the other but internally now labelled Bottom Oven) and puts his soufflé inside. But that physical oven that is at the top is still at 250°C. A few minutes later, he has a burnt, smoky crisp.

Our robot judge, FuzzQ, doesn’t need to know how to bake. It just looks at the two final soufflés. One is perfect, and the other is charcoal. The results are different, so FuzzQ sounds the alarm: “Disagreement found!”

This is how we found the bug. We didn’t need to know the “correct temperature”. We only needed to see that the two expert simulators, when given the same instructions, produced two wildly different outcomes. Knowing something now is amiss, further investigation of what each quantum simulator did with those identical instructions, can determine what actually went wrong and the problematic quantum simulator improved. By finding these disagreements, we’re helping to make sure the amazing tools of quantum science are trustworthy.

Vasileios Klimis, Queen Mary University of London

More on …

Getting Technical …

Subscribe to be notified whenever we publish a new post to the CS4FN blog.


This page is funded by EPSRC on research agreement EP/W033615/1.

QMUL CS4FN EPSRC logos

This quantum message will self-destruct in 10 seconds…

by Paul Curzon, Queen Mary University of London

A fuse burning
Image by Rudy and Peter Skitterians from Pixabay edited by Paul Curzon

Mission Impossible always involved the team taking on apparently impossible missions, delivered by a message concluding with the famous line that “This message will self-destruct in 10 seconds”. It was always followed by the message physically destructing  in some dramatic way such as flames or smoke coming from the tape recorder. Now, it’s been shown that it is possible to actually do apparently impossible destruction of messages: to send holographic messages that the sender can just make disappear even after they have been sent. It relies on the apparently impossible, but real properties of quantum physics.

A hologram is a 3-dimensional image formed using laser light. It records light scattered from objects coming from lots of different directions. This differs from photography where the light recorded comes from one direction only. You can see examples on the back of bank cards (often a flying dove) where they are used as a hard-to-copy security device. 

Now researchers at the University of Exeter have shown it is possible to make quantum holograms that make use of quantum effects. They are made from entangled photons: pairs of light particles that have been linked together in a way that means that, after the entangling, what ever happens to one immediately affects the other too … however far apart they are. Entanglement is one of those weird properties of quantum physics, the physical properties of the very, very small. It means that subatomic particles, once entangled, can later instantly affect each other even when separated by large distances.

This effect has now been put to novel use by Jensen Li and team in their research at Exeter. They entangled streams of pairs of photons emitted from a crystal using lasers but then separated the pairs. One stream of photons from the pairs was used to create a holographic image on a special kind of material called a meta-material. Meta-materials are just materials engineered at very tiny scales so as to have properties not usually seen in nature. For example, they might be designed to carefully control light or radio waves by reflecting them very precisely in certain directions. One use of that might be so that the object bounces light round from behind it so appears invisible. Some butterfly wings and bird feathers (think peacocks and kingfishers) actually do a similar sort of thing with very precise microscopic scale surface structures that cause their startlingly bright, shimmering colours.

Exeter’s meta-material was flat but with a special surface designed to have tiny features that manipulate light in very precise ways that create a hologram based on the information encoded in the beam of laser light. In their first test that showed their quantum hologram system works, the hologram just showed the letters H,D,V, A. The light from this hologram continued on to a camera, so a picture of the hologram could be taken. So far so normal.

3D axes with different coloured clouds of particles on each with yellow in the centre
Image by Smiley _p0p from Pixabay

The cunning (and rather weird) thing though is due to what they did to the other stream of light. Each photon in this stream was entangled with a photon in the hologram light stream. Due to the quantum physics of entanglement, that meant that changes to these particles could affect those making the hologram. In particular, the Exeter team had this second stream pass through a polarising filter, essentially like the lens of polaroid sunglasses. Light vibrates in different directions. A sunglasses lens cuts out the light vibrating in a given direction. Now, the letter H in the message was created from light polarised horizontally unlike the other letters which were polarised vertically. This meant that when the second stream of light was passed through a polarising filter blocking out the horizontally polarised light, it also affected the photons entangled with the blocked photons. The other stream of light, that created the hologram, was affected even though it went nowhere near the polarising filter. The result was that the horizontally polarised H could be made to disappear from the message caught on camera. It really did self-destruct, just in a quantum way.

If scaled up such a system could be used to send messages that are still (instantly) controlled by the sender even after they have been sent, whether disappearing or being changed to say something else. The approach could also be incorporated into secure quantum computing communication systems, where the messages are also encrypted.

Fortunately, this blog is not a quantum blog, so will not self-destruct in 10 seconds … so please do share it with your friends!

More on …

Magazines …


EPSRC supports this blog through research grant EP/W033615/1,

The basics of Quantum Computing: Qubits

CS4FN Banner

by Paul Curzon, Queen Mary University of London

An eye looking at two blue spheres
Image by Gerd Altmann from Pixabay

Reality is weird, very weird. The first thing you have to do to understand the reality of reality is to drop your common sense. Only then can you start to understand it especially when it comes to the quantum world of the very small. Our brains evolved to naturally make sense of human scale things, rather than the very large or very small. Accept the weirdness, though, and there are lots of opportunities, especially for computer scientists. That is why it is now an exciting area of research with theoretical physicists, engineers and computer scientists working together to make progress.

Not common sense

Imagine you are a person trying to understand the world a thousand years ago. Clearly the world MUST be flat. It looks flat and suggesting you are standing on a sphere is just ridiculous. People living on the other side would obviously fall off if it was a sphere! Except the world is a sphere and people in Australia (or Europe if you are Australian) don’t fall off. Common sense doesn’t work (until you understand how gravity works). That’s why science is so powerful. Common Sense also doesn’t work for understanding the reality of the very small. This branch of physics, quantum physics, is very important for computer scientists not only because the building blocks of our computers are becoming ever smaller, but because when you get so small that the laws of quantum physics matter, computers can work in new, exciting ways, ways that are far better than our current computers.

Bits and qubits

Let’s start with binary, the fundamental way we represent information in a computer. The basic building block of information is the bit. A bit is something that can have one of two states. It can be a 1 or a 0. That means a bit can store some information. These two states of 1 and 0 might be physically represented in lots of ways, such as a high voltage stored versus a low voltage stored, or a pulse of light versus no pulse of light, or someone’s hand up versus their hand down. If you have two bits then you can store one of 4 pieces of information in them because of the possible combinations (00, 01, 10 and 11), with three bits and you can store 8 different things. Those collections of bits can then stand for different numbers (that is all binary is), and by building big circuits from simple basic circuits that do simple manipulations on bits (i.e., logic gates) we can do ever more complex calculations with them and ultimately everything our current computers are capable of.

The spin of an electron

A pedestrian light showing green/walk
Image by Hans from Pixabay

Bits can be represented by anything that has 2 states. So suppose you want to represent your bits using something really small like electrons. Electrons have a property called spin. You can imaging them as spinning balls of charge (though they are not exactly spinning like a spinning ball … electrons aren’t balls and they aren’t actually rotating in the normal sense – remember reality is weird so these analogies are just there to help give an idea, but it is never as simple as that). Now, electrons can “spin” in exactly one of two ways called spin up and spin down. There are only two possible kinds of spin because in the quantum world things come in discrete amounts, not continuous ones. They jump from one state to another, like a pedestrian (walk/don’t walk) traffic light going from red to green instantly) rather than gradually changing between them (such as the way a car gradually speeds up to the speed limit). An electron is either spin up or spin down, like the pedestrian lights, never something in between.

Now, it is possible to set the spin of an electron and to measure whether it has spin that is spin up or spin down, so an electron can, in principle, be used to store a binary bit given it has two states (spin up for 1 and spin down for 0, say). However, this is where weirdness really comes in. It turns out that it is possible for an electron to be both spin up and spin down at once as long as the spin is not measured, due to the way the quantum world works. A quantum pedestrian light doing a similar thing would have only one light that could be red or green. However, it would be both red and green at the same time UNTIL someone looked at it to see which state it was in (so measured the state). At that point they would become, and the person would only see, one colour or the other. This is called quantum superposition. To understand this it is better to think about reality being about probabilities not certainties. Imagine that the electron is like a tossed coin that is still in the air. It has a probability of being Heads and of being Tails. Only when it lands (so is measured) is it actually one or the other. An electron is combining both possibilities until the spin is measured.

The quantum tortoise and the hare

You may have the quaint idea that reality is made of sub-atomic particles (like electrons or protons) that are solid little bits of matter that are very ball like and exist in one place at any given time. Actually they aren’t like that at all. It is better to think of particles as just having probabilities of being at one place or another – they are kind of smeared across space, everywhere at once, like a ripple pattern across a pond, just with different probabilities of actually being in any place when their position is measured. When you do measure their position you find they definitely are in one place or another, appearing to be a particle again, not a wave.

It may help to think of this in terms of watching slow moving tortoises and fast moving hares passing you as they race. The position of a slow moving tortoise you see wander by is easy to call: it has a very high probability to be in a particular place. The position of a fast moving hare that whizzes past is much harder to call: it has a far lower probability to be in a given place at any time. However, without looking you can’t tell. You just know the probabilities. Of course with particles it isn’t exactly like that just as an electron’s spin isn’t exactly like a ball spinning. It is only when a particle’s position is actually checked (i.e. measured) that it is definitely at a known place and that smeared probability collapses to certainty. A quantum tortoise and hare racing past would be in all possible positions round the race track just with different probabilities. Suppose you only checked (so measured their position) at the finish line. It is only because of that measurement that the probabilities of where they were through the race turn into specific measured so known positions with a quantum hare or a quantum tortoise having actually won.

This weirdness is linked to the fact that the fundamental components that reality is made up of are both particles in given places (think of an electron or a proton) and waves passing through space (think of light or ripples in a pond) at the same time. So light behaves like a particle and like a wave. Similarly, an electron does too. 

Electron spin as Qubits

Other properties of sub-atomic particles act in the same way as a particle’s position being smeared across lots of possibilities at once. This includes the spin of an electron. Until it is measured, an electron is superposed in both a spin up and spin down state at the same time (spinning both ways at once!): there is just a probability that the electron is in each state, it isn’t actually definitely in either. That means as long as you do not measure its spin, the electron as a device storing a piece of information is storing both 1 and 0 at the same time, each with a given probability. As such it behaves differently to an actual bit which must be either 1 or 0. We therefore call such an electron-based storage a qubit rather than a bit. 

In theory, we can do computations on qubits manipulating and combining them in simple ways using the quantum equivalent of logic gates. Once we have created quantum logic gates to do simple manipulations, we can combine those gates into bigger and bigger circuits that do more complicated quantum calculations. As long as the states of the qubits are not measured all the states through the circuit are superposed in both states with particular probabilities. Unlike a normal circuit which does one series of computations based on its inputs, these quantum circuits are in effect doing all possible computations of that circuit at once. It is only when we measure the answer at the output, say, that the qubits in the circuit are fixed at either 1 or 0 and an actual result is delivered. This is like the tortoise and hare being everywhere (whatever racing strategy they followed) with some probability until we measure the result at the finish line (the output of the race). Because all states existed at once, lots of computation exists simultaneously, this means that such a circuit can, in theory, and with the right algorithms, deliver answers far, far faster than a conventional circuit could possibly do, given the latter can only do one computation at a time,

From theory to practice

That is the theory, and it is gradually being realised in practice. Qubits can be created and their values changed. Various quantum logic gates have also now been invented and so small quantum computers do now exist. Quantum algorithms to do certain tasks quickly have been invented. Since the original ideas were mooted, progress has been relatively slow, but now that the ideas have been shown to work in practice, more and more is being achieved, making it an exciting time to be doing quantum computing research.

More on …

  • Quantum Computing (to come)

Subscribe to be notified whenever we publish a new post to the CS4FN blog.



This blog is funded through EPSRC grant EP/W033615/1.