>> Good afternoon.
We're about to start.
Next we have Jorn Mossel and Marianne Hoogeveen,
with their talk on: The cat's alive!
Add some weirdness to your code with quantum
computing!
(applause)
MARIANNE: Hi, everyone.
Is my mic on?
Yeah?
Can you hear me?
All right.
Good.
Hi, everyone.
My name is Marianne.
I'm a former physicist, turned data scientist,
and this is Jorn, also former physicist, and
now he works in finance.
But I first want to know something about you.
How many people came here to hear about quantum
computing?
It's actually a lot.
How many came here to hear about cats?
JORN: Even better, even better!
MARIANNE: One of you is going to be disappointed.
I won't say which one.
You'll find out soon enough.
JORN: Maybe both.
MARIANNE: Maybe both.
Let's hope not.
So the reason why we're talking about this
is...
Back when I was still in grad school, there
was some talk about quantum computers, and
they used to say a lot of big things about
quantum computing then already.
But the criticism was always...
Okay.
But what can you do?
They would talk about factorizing prime numbers
and how that would affect cryptography, and
if you asked them...
All right.
What does that do?
They can say we can tell you that 15 is factorized
by 5 and 3.
And I would say...
Yeah, but so can I.
It's not very impressive.
But really why we're here is...
We have this conference, and there's all these
talks that are about making you you more productive,
and about writing better code, making fewer
mistakes, but we're getting all too good at
our job.
You're all way too good, and all your code
is way too error-free.
It does what you want it to do.
You test it.
Continuously.
You get great code reviews.
So we also want to add some more excitement
in your lives by teaching you something that
will make your code buggier and perform less
well and add more surprise to everything that
you do.
So you're welcome.
We're here to help.
(laughter)
So...
What has changed since we first heard about
quantum computers and we learned the magic
fact that 15 is 5 times 3?
Well, this is quite timely, because while
we were preparing this talk, Google claimed
to have reached "quantum supremacy".
So what quantum supremacy means is that they
can now do something with a quantum computer
that you couldn't do with a classical computer,
even a supercomputer.
So the holidays are coming up.
And I'm gonna be going home, and I want to
buy my mom something different.
And I want to do something fun.
So should I buy her a quantum computer?
So the question is...
Let's say I want to fork over...
I don't know how much it costs.
Let's say I want to fork over that cash.
What can I buy for my money?
I just made a spec sheet.
That's how you make decisions.
What can you buy?
If you buy a classical computer, and what
can you get with a quantum computer?
So well...
Should I buy her a quantum computer, do you
think?
JORN: Of course you should!
MARIANNE: Sell it to me.
JORN: On the left you have a standard Intel
CPU, like the laptop you're presenting with.
Does exactly what you want, but we all know
it.
It's no fun.
Take the guy on the right, the IBM Q. It looks
good.
MARIANNE: But they're only showing one tiny
bit of it.
I'm sure it's huge.
JORN: It's a mess.
You need some space.
But the interesting bit of it is has not 64
bit, but 14 qubit.
The quantum bit.
That's gonna be the interesting bit.
I think you should try it out.
MARIANNE: Okay, okay, but the price is a little
bit steep.
I noticed...
JORN: Well, it's something new.
Right?
It's always when you buy something new, it
comes at a high price.
MARIANNE: I mean, mom, I love you, but $5
million?
I see something with a gate error?
I see e-21?
It seems a little bit error prone to me.
JORN: Let's talk about it later.
MARIANNE: Okay.
I'll start saving.
So what are these qubits that he was trying
to sell me on?
Well, if you look at a classical computer,
you all know.
There are bits.
0 or 1.
But a qubit can be a little bit of both.
So what does that mean?
We're depicting a qubit over there as a sphere.
So the state of a qubit is some value on that
sphere.
And rather than 0 or 1, which are two discrete
values, the sphere is actually continuous.
So it can take, you can say, an infinite number
of values.
So the trick here of course is...
You don't know what value it is until you
measure it.
And in quantum mechanics, measuring is actually
interacting with the system.
And causing its state to change.
So when you measure it, its outcome will be
either 0 or 1.
So you're still, again, have only two states.
But if you do it many, many times, then depending
on where it is on that sphere, the outcome
-- the distribution of the outcomes will tell
you something about what the original state
was.
Not everything.
But it'll tell you something.
And that's also kind of the richness that
these qubits bring.
So let's talk a little bit more about what
you can do with these weird quantum states
on that sphere.
Well, first, actually, let's talk a bit about
quantum states.
The quantum state itself.
So there was a famous physicist, Erwin Schroedinger,
who had an even more famous cat.
Maybe the cat lovers here are happy after
all.
Well, until you see that vial of poison.
You'll be a little bit less happy.
I'm sorry.
It might turn out fine.
So you have a cat in a box.
You cannot see it.
That's important for quantum mechanics.
You want to not observe the state, because
observing is interacting and kind of destroying
the quantum nature of that state.
So you have a cat, and it's in this closed
box that you cannot observe.
Some process that can happen or not, some
quantum mechanical process, say, could occur.
And if it occurs, some lever will drop and
the vial of poison will be opened and the
cat will be dead.
I'm sorry.
Or it doesn't happen!
And then the cat's alive!
So these are our two...
Oh, sorry.
These are our two cases.
Cat stays alive.
Cat doesn't stay alive.
But the funny thing about an interpretation
of quantum mechanics is that until you check...
So once you check, it's either dead or alive.
I mean...
We know that.
I mean, if we open that box, we don't expect
it to be in some...
We expect it to be either dead or alive.
But until you check, it's both.
And that's the crux of the superposition.
This quantum state.
So what can we do with these...
How can we do something with these qubits?
And especially what kind of things can we
do that we cannot do with classical bits?
So here you see one simple gate, a NOT gate
that acts on 1 qubit.
And it just negates everything.
It inverts the state.
Kind of what you would expect, right?
So if you have a state pointing that way,
it points the other way, and if you look at
the probability measurements, they are also
inverted.
And there's other states, like, for example,
this rotation.
It's a rotation around the axis of measurement,
and you might expect something to change if
you change the arrow, but in this case, you
don't see anything.
So if you just do this and then directly observe
it, there won't be a difference.
So the difference happens only if you do multiple
qubit states.
Gates.
So an example of a multiqubit gate is making
entanglement.
Entanglement is a really weird quantum phenomenon
where two qubits kind of know something about
each other.
Even though you can't explain how.
So classical correlation typically involves
some kind of information being passed in some
way.
But quantum correlation or entanglement is
something that can exist even if there's no
causal connection between the two.
So you can have one qubit here, another at
the other end of the universe, and they're
entangled.
If you measure one, you know what the other
is.
Even though the measurement of the one could
still be random.
So here you see basically two qubits.
You measure them individually.
You measure one.
It's zero or one.
You measure the other.
It's zero or one.
And basically all the combinations, zero,
zero, zero, one, let's say all of them are
equally likely.
This is just one possible state.
They're all equally likely.
No information about them whatsoever.
But you see the bottom one.
This is how we depict an entangling gate.
So what you see is...
I've painted the arrows orange.
But other than that, the state hasn't changed,
of the individual ones.
If I measure the top one, it's still zero
or one, with the same probabilities.
If I measure the bottom one, without having
measured the top one, if I just measure the
bottom one first, it's zero or one.
Both can happen.
But then if I measure one, and then measure
the other, actually they are correlated.
So in this case, I've correlated them in a
way that if one is zero, the other is zero.
If one is one, then the other is one.
It doesn't matter what order you do it in.
So that's entanglement.
So now Jorn is going to tell you about a real
life example that you could use this in.
It won't work great.
JORN: Hey, no spoilers, please!
MARIANNE: So Jorn, take it away.
JORN: All right.
Thanks for putting up with the physics.
Now we're gonna get the example.
So we have this super hard problem, right?
We have eight dots here.
We want to group them in two natural groups.
Of course, everyone can do this.
Probably even the cat if it's still alive
can do this.
But in general, in data science, this is a
problem we see often.
We have lots of points and then typically
in higher dimensions, it's actually an NP-hard
problem.
We have something like k-means, but this is
only an approximate solution to the clustering
problem.
What we want to show here, the two concepts
that Marianne just illustrated, superposition
and entanglement, how we can exploit that,
to run it on an actual quantum computer, and
efficiently find good solutions...
So let's see how that works.
Let's go over it one more time.
So the nice thing here...
What I depicted is basically all possible
cluster configurations.
If you have N points, 8 in this case, you
have 256, and you load them all simultaneously
in memory.
So that's something you can't do on a classical
computer.
Well, okay.
If it's 8, maybe you can.
But if it's 53 qubits, the one Google used,
then you have about 10^10 possible configurations.
And no way you can load that in any supercomputer
simultaneously.
But on the Google one, you can do that.
So that is already a nice feature about the
quantum computer.
But this alone will not help you a lot.
So what we need is actually entanglement.
So that is a way to add information to the
system.
So on the right, we see all qubits, and they're
all in some state.
But they're still independent.
But then you can add something like all these
lines to somehow denote entanglement, so they
know about each other, and then the superposition
should actually change and should go to a
state that you're actually interested in.
So all right.
We talked about cats.
We talked about physics.
But I think this is a Python conference.
We haven't really talked about that.
So...
Last minute.
We thought...
Okay.
We have to do something about it.
So we hacked together a notebook.
And the great thing is: IBM, they have actual
quantum computers that you can access on the
cloud, and they have even some packages for
that which you can easily install that's all
demonstrated in this notebook.
So basically what I'm going to walk you through...
What I did is to run the clustering example
on an actual quantum computer.
I'm not gonna run it live, because I'm sure
I will mess it up.
So I will just go quickly through it.
So this is basically it.
So actually, this graph, this is so-called
the quantum circuit.
I actually generated it also, with the same
notebook.
So on the left, we create a superposition.
I just talked about it.
Then we have a few layers of entanglement,
and then we do a measurement and hopefully
we find a good cluster.
So let's look at one thing.
I have all these purple boxes.
They're actually a sequence of smaller quantum
gates.
Some of them Marianne already touched upon.
This is what I need to create some sort of
entanglement.
It doesn't matter if you don't get all the
details.
So here on the left you see actually the code
I used.
It's pretty straightforward.
Pretty much every line is a box there.
So that adds another circuit.
Instead of, say, an AND gate or whatever,
it's a quantum NOT gate that Marianne touched
upon, and she showed another gate to create
entanglement, and I combined all these here,
and there are some parameters, and I can use
these parameters to tune how much entanglement
I want.
Or what type of entanglement.
So on the left here, we see...
If you tune it that way, then if you measure
one particle and it's zero, then the other
one will be zero.
If you go all the way on the other side, if
I measure zero and one, it will guarantee
to get to one in the other one.
They will have opposite spins.
This is very useful if you want to implement
this for clustering.
So let's go over the circuit.
So again, we have added a few lines of code.
And that basically gives you this first block.
And this just creates the superposition.
So it basically tells you: Load all the possible
configurations at once in memory.
All right.
So let's do actually a measurement at this
point.
Let's see what we get.
So what we have here -- so this is energy.
We're still physicists.
But basically all you need to remember on
the left is the best cluster and on the right
is the worst cluster.
And then we have these probabilities.
If you do one measurement, what is the probability
that you get, say, the best cluster?
And it's below 1%.
And actually, all of them are equally likely.
So at this point, it's just a quantum lottery.
We haven't gained anything.
You can just flip a few coins and try a configuration
out and see...
This is my cluster.
And why?
Well, this whole graph is empty.
That means there's no entanglement yet.
We have not supplied any information yet.
So it's actually not really surprising it
doesn't work yet.
So now the next step, all these pink boxes,
if we basically take the code we saw above,
but again, it's straightforward...
So if you go back to our cluster, one thing
we can do, on a classical computer, I can
compute the pairwise distances.
That is straightforward.
You don't need a fancy computer for that.
It's only a quadratic problem.
If the two dots are close together, I want
to entangle them so they end up in the same
state.
I don't know yet if they end up in cluster
one or two, but if I say this one is in the
first cluster, it's very likely that this
one should also be in the first cluster.
But it could be that both of them end up in
the second.
So we have not made any cluster assignments
yet, but only pairwise relations.
So okay.
We have added that information out to the
system.
And let's see what we get.
All right.
This is starting to look better.
You see that now some states are more likely.
So the best one -- now we have 4%.
And some state we won't measure at all.
And you can see that -- so we have now some
entanglement in the system, but there's still
some places -- there's no entanglement where
we don't.
Yeah.
We have not fully exploited all the information
yet.
So let's do just another layer.
And so now we take different pairs.
Because before that, we could basically split
the system in exactly two sets, which we don't
know about yet.
So by adding these extra pairs -- now everybody
knows about each other.
So let's see what we get.
All right.
So now the best cluster is 12% or so.
That's not bad, I would say.
And the worst cluster is really small.
And if you see the entanglement...
It's decent.
It's spread out over the system.
So again, I want to emphasize that this is
all because we have only a few particles in
the simulation.
Right?
So normally you can't really compute all these
things.
If you run this on a quantum computer.
So let's do this actually on an actual quantum
computer.
So I've already done that.
So all you need to do is you need to go to
the IBM website, you create some account,
you go online, and then on the right you see
some devices that are online, and what the
queue is.
So you pick one.
I picked the top one in this case.
And then basically you load up your circuit.
We had defined it earlier.
And then you run it, and you see what comes
out.
So this is the actual result.
The blue one -- this is the simulation.
And the orange is the experiment.
So the correlation between these two is 53.
It's okay-ish.
But something that doesn't look good at all...
If I look at the best state, it's only 2%.
Come on!
We had these 8 particles and this quantum
computer, this $5 million thing...
The best it does is assigns 2% probability
to this state.
This is not really that impressive, I would
say.
Actually, when I was playing around with this.
I initially had a better solution.
But then I thought...
Let me clean up the code a bit.
I made small tweaks.
I thought this was better.
But then actually the result went down.
And I spent the whole weekend trying to figure
out what changed.
And then I was digging a little bit deeper.
And since we run this on actual hardware...
Let's see what the hardware does.
So on the IBM website, you can actually basically
get the configuration of the quantum computer.
And here you see these 14 qubits, and you
have these colors, and these colors tell you
what the gate error is.
So what Marianne was worried about at the
beginning...
Oh yeah.
This is...
These gate errors seem a bit high.
It is actually a bit high.
And it depends on the actual...
Say, number 4, quite a poor qubit.
But the others are a bit better.
What happened is when I changed my code, my
configuration changed over this.
And the alignment was less good.
So I have not done any optimization here.
So this is actually a real problem in quantum
computers.
So that's why we haven't got amazing results
yet.
That we need to tackle this somehow.
And that is both a challenge for physicists
that need to basically improve the hardware...
But it's also a challenge for computer scientists.
Because you can, for instance, add a few extra
qubits to do some error correction.
And I have not done any of the quantum correction.
I just did the plain vanilla one.
Thought intuitively it works fine...
But yeah, then in practice...
Slightly...
Some more work to be done here.
MARIANNE: Are you telling me I should get
my mom a book?
JORN: A book?
MARIANNE: A book instead of this?
JORN: Yeah, maybe hold off for now.
Hold off on the quantum computer.
Okay.
So this is only one example.
But what I want to stress here...
I chose the clustering.
I don't want you to walk out now and you think...
Oh, I'm always using k-means so I could learn
and now this dude is telling me I need to
use a quantum computer.
No.
That is not the message.
The only reason I chose, actually, clustering
-- because it is nice to illustrate the concept
of superposition and entanglement on the quantum
computer.
There are actually other interesting problems.
So let's look at a few of those.
So the first one...
That's what Marianne mentioned.
That's Shor's algorithm, prime factorization.
The record is now maybe 21.
So there's some improvement.
Right?
Not 3x5, but 3x7.
But the second one is actually more interesting.
So normally if you want to -- say you have
a phone book and you want to look up someone...
You get the phone number and you want to know
who the person is.
This is an old school paper phonebook.
When I was in undergrad, we still had those.
Then you need to basically do a linear search.
So that's an N problem.
But you can actually implement quantum algorithms
where it's √N.
So that's a big speedup.
The other thing is -- I showed the clustering,
but there are actually a lot of business problems
that require solutions, but finding the exact
solution is NP hard.
But you still need a good solution.
So the traveling salesman problem is a good
example for that.
Where I say some salesman needs to go to different
cities and wants to find the optimal route.
You ask the mathematician: What is the best
route?
The mathematician says...
I don't know!
But still the salesman needs to go on the
road to sell his stuff.
So you want to quickly find good solutions.
So that is in the same spirit as we did the
clustering.
You could tackle something like traveling
salesman, and more generally, you can actually
do many discrete optimization problems.
Actually, Marianne is working in a farm and
she is thinking about actually where she needs
to do a lot of optimization, actually getting
the quantum computer.
So you're gonna buy it for yourself.
All right.
Thank you.
And I think I need to click one more slide.
Yes!
The cat is alive!
(applause)
Any questions?
>> Good news.
We have a lot of time!
So feel free.
Which brave cat wants to meow?
(assorted meowing)
One minute.
Okay.
We've got time for one cool cat.
There we go!
>> Oh.
I was looking at MIT's course offering quantum
computing.
Have you guys looked at that?
And also...
Can you really use Python libraries now for
quantum computing?
JORN: I'm not sure which exact MIT course.
There's another course on EDX that is quantum
machine learning.
That heavily relies on QES kit of IBM.
Our talk is a bit inspired by that course,
actually.
>> And I think Google is offering on the topic?
What they were saying -- they got supremacy
on that?
That's Google's story.
JORN: You're asking if Google Open Sourced
their...
>> Are there any courses on that?
Google is now claiming supremacy on quantum
computing.
Have you heard the news?
You haven't?
JORN: Sorry, so Google, that was the slide
we started off with.
So basically what they showed...
So they used 53 qubits, and they solved a
problem which you can't solve on a classical
computer.
But what they solved is they basically...
You have this problem in computer science
where you have a random number generator,
and you want to test how truly random that
is.
So it's actually from a computer science point
of view an interesting problem.
But it actually hasn't any applications, as
far as I know.
So they solved that problem, but no business
problems yet.
So yeah, yeah.
They have to brag.
Congrats to them.
But we still have to wait for the first actual
problem that we can solve without a classical
computer.
>> Thank you.
That's a wrap.
(applause)
