Hello again everyone, I'm
sumner i'm a graduate student at
Matter Lab
in the department of Chemistry at the
University of Toronto
and today i'm going to be talking to you
about "Tequila",
a software package that my group has
been working on for about eight months
now
this software package is currently
in its live beta
So if you go to https://github.com/aspuru-guzik-group/tequila
you'll be able to find it
i will also screen share that page for
those
more interested um now since i'm going
to be talking about quantum computing
here which i know is a field that many people might not
have
a lot of exposure to, might not know a
lot about;
I'm going to really quick show everyone
a brief
two-ish three-ish minute presentation
on what quantum computing is actually
about
so that we're all basically up to speed
so that we're all on the same page here
so i'm gonna throw on some screen share
and get to that now
all right and let's throw this all
up into full screen mode
i knew where this setting was five
minutes ago i should be able to find it
again
and if not oh well
so quantum computing a quick
rundown
so what do we mean when we talk about a
quantum computer
what is a quantum computer
well it's quantum
in the sense that it's an array of
quantum systems
In general, those are two level
systems
Because we really have a sensible
understanding of what those do those are
easy to manufacture. We call it two level system, a q bit
quantum analog of a bit using a
quantum computer. Means controlling
unitary evolution of a quantum state
for those not fresh on their math a
unitary is a matrix
that is symmetric
or rather it's uh its conjugate tr is
the same as its transpose
and when you multiply it by its
conjugate transpose you get the identity
so it's a specific kind of matrix
multiplication
physical quantum computers are things
like
tiny ions in a magnetic field in a
laser trap
the polarization of individual photons
in
a circuit device or even super
conducting circuits
chilled all the way down to single digit
millikelvin where they where these
macroscopic devices will begin to
exhibit
quantum behavior despite their
micrometer to cm size.
It's a computer
in the sense that it implements exactly
two operations
The first is that a unitary in the two to the n unitary group
acting on
vectors in the 2 to the n hilbert space.
No matter the unitarian no matter state is
at most polynomial in n
specifically it should be no greater
than n squared
there also needs to be some kind of
quantum measurement we refer to that as
a POVM -
Positive Operator Valued Measure and
that should happen in
constant time that should take a quantum
state
to a that is on n q-bits
to a bit string of length n. This is
collapsing the wave function
if we're all familiar with that term
how do these devices compare to classical computers?
well a q-bit stores information
densely, that's one of its strength.
If you have n q-bits you would need two to the n
classical bits to store the same state and when n is anything
modest say 16 32 12,
that's more classical bits than you're
going to be able to find
they multiply matrices faster as well
that
n squared scaling is a lot better than
you're expecting
and entanglement on a quantum device is
in its own
sense though this requires a little more
rigorous formalization
it is a computational resource in itself
these devices aren't magic though uh
it's been proven that you can't
copy a quantum state an arbitrary
quantum state just
given the state there is no copy and
paste
on a quantum computer when you measure
a state you change the state
permanently so there's this loss of
information
every time you try and actually get
something out of the computer readout is
a one-time event
uh and in a sort of more meta textual
sense
these devices are sort of mind-boggling
it's hard to wrap an intuition
around it they don't work the way we're
expecting them to
uh based on experiences with the rest of
the macroscopic world
so that can influence our thinking about
them in ways that may make them harder
to use
the graphic i've included here credit to
the wikipedia article
on quantum complexity theory uh shows
where quantum theorists suspect
BQP which
is the bounded time quantum polynomial
complexity class it's the quantum analog
of p
How that relates to classical
complexity?
it includes all of p, sum of np,
none of np complete and sum of p space
that's a really weird overlap but
there's a lot of useful stuff that goes
on outside of p
and that isn't np complete so there's
still a lot of power there
uh just about the field a bit uh
i would identify sort of three major
events if i had to pick
three there's of course been more in
1984
richard feynman in a paper first
theorized that quantum computers
were what you would need to simulate
quantum systems
which people were and still are having
trouble with
it makes sense that you would need a
device that could
behave like a quantum system or indeed
was
one in order to actually replicate
important quantum behavior in 1994
peter shore published his factoring
algorithm
this does in polynomial time
what the best known classical computer
or requires
exponential time to do
famously this means that the RSA
encryption
that your bank account uses is no longer
safe the second someone gets their hands
on a fully operating quantum computer
so uh a motivating factor in sort of the
further development of quantum computers
and quantum algorithms was so that
some evil mastermind with a quantum
computer couldn't destroy the global
economy in 2019 sort of the most recent major
milestone scientists working at google
announced quantum supremacy for the
first time
so that's the first time that a real
quantum computer
on a specific and well-defined task did
better than any super computer could
by orders of magnitude
that's the first time a quantum computer
really in a physical test case
proved its worth so to speak
but i need to tell you a little bit
about the state of the field to tell you
about
what it is i'm trying to do in this
field so we're entering what's been
called the noisy
intermediate scale quantum era NISQ
is what it's usually called in the
quantum community
Here the devices we have
have between tens and hundreds of q-bits
they're noisy uh you need to
if you're going to do anything useful
you need to use algorithms that are in
some way resistant to noise
to random errors that we can't control
and you need them to be able to run
fast you can't get a deep circuit that
has
you know thousands hundreds of thousands
of operations that's
that's not going to fly hundreds
to a thousand is where we're looking at
Now the kind of algorithms that
work well in the NISQ era are called
VQA - Variational Quantum Algorithms,
They're a hybrid class of algorithms in which some parametrized quantum operations
are optimized by a classical optimize. Sort of this 3-way loop between
1. The quantum device running a quantum circuit
(that's how quantum scientists refer to these unitary matrix transforms
that operate on quantum states)
2. We have some measurement apparatus to send data back to
a classical computer running a classical optimizer
3. We iteratively improve the
performance
of whatever task we've defined and have
encoded
into the quantum program
this leverages sort of the best of both
worlds to the best we can
and there's a lot of theory and even
some evidence
suggesting that these are much more
noise resistant
than the strictly deterministic
unparameterized quantum algorithms
that sort of first laid the groundwork
of the field
two kinds of algorithm that are really
important
maybe the most important vqas are the
vqe
originally pioneered by my research
group
uh back in uh 2010 or so
uh that's the variational quantum
eigensolver
given some hamiltonian h and some
parametrized unitary u of theta
your goal is to minimize the expectation
value
of that hamiltonian acting on the state
created by the unitary onset said
choices are critical here
uh they need to relate to the
hamiltonian in some way or you're not
going to have any luck
and the real varying thing in this
family of algorithms is what kind of
classical parameters
optimizer you use what kind of unitary
you're using how you transform the
hamiltonian and so on
there's also the quantum approximate
optimization algorithm
due to edward farhan at all
and this is a little bit different it
has a really well-defined
onsets and here you've got a hamiltonian
where you've somehow encoded the right
answer into the hamiltonian and here you
actually maximizing a little bit of a difference in the
way people think about these algorithms
so the software i've developed tequila
tequila is an extensible quantum
informatics and learning architecture
that's a recursive algorithm like
gnu is focused mainly on
these vqas especially on the vqe
and especially targeting chemical
applications
quantum chemistry is one of the leading
applications of quantum computing
uh in the current age so
uh without much further ado i'm going to
run
through the actual uh
usage of this software package uh you
should see now
uh the github for tequila
link up here in the top
that's
https://github.com/aspuru-guzik-group/tequila
like the alcohol. { host: your screen is not
visibl }
the screen is not visible oh wonderful
this channel let's get that working
uh new share uh
okay
am i good now yes
wonderful sorry about that all you
viewers at home
uh so the point of tequila and the real
design philosophy here
is that we wanted to create a package
that sort of worked
the way quantum scientists think uh
a lot of that time we talk about these
ridiculous
operators that are easy to write down
exponentials of
some infinitely long hermitian matrix
talking about gates in terms of
generators talking about optimizing
strangely transformed
expectation values and unitaries uh and
we wanted to make that easy
here's a little graphic with example
code from tequila
showing how quickly you could write up
and optimize a a
sort of bizarre exponential to the
square
objective i'm going to dive right into
some usage tutorials for tequila real
quick
so we're going to restart and run a bit
so basic usage of tequila it's a python
package
it interfaces a large number of other
packages
your favorite quantum simulators like
circ and kiskit
respectively packages affiliated with
google and ibm
uh are all available here so
just import tequila as tq and see what
simulators we have so we've got
installed on my machine culox
a very powerful simulator uh
very fast kisket circ pi coil and a
built-in symbolic simulator
with a number of abilities wave function
sampling
uh regular sampling noisy simulation in
some cases
and this little uh subheading tells you
what's installed it's easy to create
circuits uh circuits again being the
quantum
analog of a program you just use the
tequila gates module and it has all the
commonly defined gates you might look
for
hadamard c not whatever suits your fancy
so let's see what that uh circuit looks
like when you print it out we just get a
list of the gates the qubits they act on
what controls them
so we've got a two qubit circuit here
uh we can draw the circuit out using uh
circ's draw feature
uh and you just get what the circuit
looks like it's a hadamard gate followed
by the controlled knot
that's as a quantum gate
but you can get a lot stranger than that
uh you can do double hadamard
uh and you can also get some really
longer circuits this is all just playing
around with various
ways of initializing gates so if you had
uh a generalized rotation gate
which is just the exponential of
a complex projector onto a state tequila
can do that too
can compile it down to simpler versions
we can do easy simulation so
this um somewhat complicated circuit
acting on a null zero state
leads to one of the uh four
magic basis states uh this is the
uniform
superposition over all states
who'd have thunk
uh we can simulate it with other uh you
can specify what back end
you want to use you could measure
instead
so we see here when we run it in this
case with 10 samples you
always get the zero zero state
you could do it considerably more
you get six times the one zero four
times
zero zero but we're really focused here
on
parametrized quantum circuits
uh so here we simulate just an ry
gate that's a specific quantum gate with
just a string initialized variable
and all you need to do in tequila to
work with
parametrized circuits is you pass down a
dictionary of
strings and numbers and wherever you've
thrown a variable
any hashable type into the circuit we
will handle that for you
uh so you don't have to do any kind of
deep in the weeds
wrangling with the simulation back end
but more importantly than that
we can um transform
this circuit so we can exponentiate
an angle inside and you can say okay i'm
going to feed you this number but i want
you to exponentiate it every time
and you just do that with the dot apply
method
uh you can get really bizarre with your
transformations you could
take the gaussian of it and you just
apply your transformation
as seen here run your circuit here we
run it with
the parameter a set to 1 and we get out
of course simulatedly a
specific one cubit state
we could say have an angle that's a
more bizarre hashable type any hashable
type will work
so if you want to get really bizarre and
you pass down
uh the tuple 1 a and
it's a stupid example that works too we
try to be as flexible
in the code base as people might want to
be but the real focus here
is on optimization and for that we have
these really easy
classes that sort of from the core of
tequila
these are our objective and expectation
value classes
objective is just any transformation on
any quantum or classical data
and an expectation value uh is what you
actually measure on a quantum circuit
made up of some hamiltonian and some
unitary we implement that directly as a
class
so that you don't have to figure out how
to do it yourself
so we can use a simple unitary r y of
some angle a
our hamiltonian will be the sigma x and
we can optimize that
simulating it with the parameter uh a
equals 1.0
gives us back a expectation
value of 0.84147
this is a bounded expectation value
since it's a single poly word
so it has to be between 1 and negative
1.
but let's say that we cared about this
and we wanted to optimize it or let's
say we wanted to do it with some other
circuit uh we could build
any uh hermitian matrix we want
and use it as a projector or as a
hamiltonian building it out of these
poly words
the z the y the x in whatever fashion we
want
and we can optimize over things that are
more complex
you can compile the objectives and run
them
and so when we compile an objective
with this sort of bizarre hamiltonian
x on all four qubits y on two
z on zero and one tensor product with
exon two
uh and we optimize it or sorry we uh
plot it over a number of values
we see that it's actually just this
little oscillating thing
uh what if we want uh to run
e squared to plus one where e is our
former
well we get a gaussian two
or rather we get two gaussians we have
this um
we want to actually say gaussians we
have this all above zero
oscillator with a different period
what if we want to shift it by e to the
negative a
squared where a is the same variable
we've been using in the circuit
you can do these sort of weird
interactive
transformations of quantum and classical
data
what do you want to get absolutely crazy
what if you want to exponentiate the
negative
square of the expectation value itself
and then you wanted to add the
exponentiation of the negative square of
a variable and multiply that by an
expectation value
we're totally agnostic to that here's
what it looks like
it looks kind of like the back of a
camel one hump's a little bigger than
the other
but other than that everything works
perfectly fine
however you want to build your objective
we can do it
you can take gradients of objectives we
interface the package
jacks uh the successor of
auto grad to let us automatically
differentiate
functions over quantum objectives so
that you can
optimize whatever you want agnostically
of how the gradient is built
if you're doing gradient based uh
compilation
so you see here if we take the gradient
of some objective uh here we know that
it's this sinusoidal function
we get back that its gradient has this
over the variables just like we'd expect
for that sinusoidal function
and the second derivative uh is as we
are expecting for sinusoidal functions
the negative of the original
we have more uh examples even further
so this weird uh camel hump thing uh
yields this is the first derivative
and this somewhat bizarre second
derivative
i'm a little low on time
so i'll dig real quick into interfacing
more popular optimizer packages
uh tequila in addition to having plugins
to all your favorite quantum simulation
packages
also because it's targeted at vqa has
interfaces to popular um
classical optimization routines among
them scipy one of the most uh
prolific optimization packages we've
built a setup that makes that
easier for you to use so let's say we
have this hamiltonian
sigma x plus some constant times sigma z
minus sigma zero or minus sigma z
on a different qubit
well this hamiltonian matrix is uh given
here
uh who knows what it really means
but that doesn't matter you can optimize
over it
so we'll build an onsets uh it's sort of
hard to tell at this level what these uh
unitary circuits are but we have nice
drawing
features so you can see that it's this
series of gates
a few controls several parameterized
gates
and it's got two classical readouts
uh it is easy to simulate this uh
this circuit has um three variables
a b and c setting them all to a one
4 uh you get negative
6 times 10 to the who knows what uh
squaring it and simulating it you get an
infinite decimal
as you'd expect for random variables and
you can optimize
uh easily running the bfgs optimization
a gradient based optimizer that's
quite popular in the quantum community
you can minimize this
and we get that the best we can do is
negative two
ballpark we can get the parameters
final energy and we've built in plotting
features
so you can see there's this rapid
convergence to the minimum we found
we can plot the angles over time
and we can plot the gradients over time
as well
this final plot shows the angle c over
time but also it's gradient
from optimization step to optimization
step
so i think i'm a little bit over time uh
but i'd like to
point everyone who is interested back to
the github
uh or just google um
aspuru guzik group uh slash tequila and
you should be able to find it
uh all right thank you very much for
watching and i suppose now i will turn
it over
for questions
as soon as i figure out how to get stop
sharing
so stop thank you very much sumner for
this wonderful talk
so right now i will ask uh some
questions
and according to the audience if you
have any questions please do
uh share them in the question answer
questions
uh this chat box that we have on
live.gitcommit.show
if you are not there please go there and
ask your questions
and also there is a clap button and to
showcase
your appreciation for the speaker and
did you like this talk
and not so now
you can identify me as someone who is a
quantum computing enthusiast so
i do not fully understand everything and
what's going on there
but i am curious about those things i
have tried things such as cirque
i started trying that
but then i couldn't so before actually i
move on to the questions
related to your talk uh one question i
have is
specifically how do i get started
with with quantum computing as a
programmer
who doesn't have uh the knowledge all
the knowledge
that uh that is needed to do these
optimizations or
move into this deep stuff and uh on the
same
topic i have this uh one specific
question that
how do i debug i can write the code uh i
can use the library cirque
but how do i debug that so that's my
question
all right so if one if one has a strong
enough programming background
but needs to get deeper into the physics
of what's going on
there's this one specific textbook that
in the
quantum science community is the first
thing your supervisor puts on your desk
on your first day of graduate school
and that is the textbook uh by nielsen
and chong
by michael nielsen and isaac chuang it's
affectionately referred to as mike and
ike
uh every quantum scientist uh has that
sitting above their desk um it's not the
cheapest thing in the world but i'd be
surprised if you couldn't with a little
bit of finesse
find a pdf of it on the internet uh it
it's excellent it has most of what you
need to get a
working understanding of what's going on
it's significant enough of a textbook
that it is
mentioned on the wikipedia timeline of
quantum computing
uh so uh i would definitely recommend it
i think
there's nothing i could really recommend
more highly if you want to really get a
picture of
what's going on why does what's going on
matter
what are we doing here uh it's a great
start
so actually developing uh so the package
you were talking about
uh cirque uh was one that i sort of
first uh cut my teeth on as well so to
speak
and actually moving with that to
development um
the difficulty of that is sort of what
motivated building this
package too because you know that code
can get really in the weeds it can get
really idiopathic
there's hundreds of different quantum
simulation codes out there
uh by my count there's over 140
um and so
one problem that actually really affects
the quantum community is
nobody's really sharing their code and
even if they did
they wouldn't be able to tell what
anyone else's code did
unless they were familiar with the
idiosyncrasies of
umpteen different packages so there's
not really a straight answer on how to
get developing
seriously once you're familiar with that
sort of coding
apparatus because the truth is it's sort
of a tower of babel situation at the
moment
got it so do you suggest the trial and
error method first read about the books
read the book and then
try out the different simulators yep is
that
yep find one that's your favorite and
runs relatively fast on your computer
and just sort of tackle it
um
there are also various online courses
that you can take there's an edx course
on quantum machine learning
specifically which is very good i was
originally taught by the
the now late doctor peter vitek who
literally wrote the book
on quantum machine learning he
unfortunately
passed last year in a hiking accident in
the himalayas but
the course lives on is i believe should
be free to access for all
uh and that is also a good way to get
into some of um
the more specific cases and really see
how things all come together
can you share more about your setup how
do you
when you code this so the code that you
showed us on jupyter notebook
uh when you code this how do you so you
probably test it on
simulator or is there anything else
involved like testing it on live
computer or
anything else that's involved uh so we
actually do
have a um a plug-in so that you can
straight from tequila
interface the uh
available quantum computers of the day
uh to my knowledge there's only two
companies that
make actual quantum devices available to
the public
that's uh the righetti corporation uh
and ibm q we have plugins for that
so anything that runs in a reasonable
amount of time
we do try and make sure our code works
well with those
uh of course time is expensive so we try
not to
waste it but mostly it's done by making
sure everything works with the local
simulator
um it's at a point we're at a point in
the quantum community where
you still want to know what
a real quantum computer would do
before you actually send your algorithm
to it
got it and are we able to make some
programs
which can add value to some of the stuff
like
what kind of calculations are we able to
do and
can you share some benchmarks of those
calculations so that people get to know
the difference from
normal computer and what we are doing
here
right so um
with currently existing computers
i'll be honest not much yet the noise
remains a problem
uh though progress in recent years has
been
exponential progress the size remains a
problem though again
exponential progress is being made still
to a goal that is some
years away it isn't the same as
cold fusion which has been 20 years away
for a hundred years
but it is still a more distant goal
but um one
application that where it's quite clear
that the quantum computer will be
necessary
is for uh simulating the energies
of uh hamiltonians for chemical systems
so uh you need exponentially good
accuracy
uh in those to be accurate because um
the quantum energies of molecules
uh rates of chemical reactions depend
exponentially on the differences
between energies of various molecules
so a little error in the energy becomes
a massive
absolutely massive difference in the
reaction rate and that's really
important because we simulate these
uh quantum molecular energies in a
diverse array of fields
it's what you do for solar cell design
for drug discovery uh for
um industrial catalysts it's really
the real money computationally in
chemical and materials science is doing
this and the quantum computer
can a fully working large enough quantum
computer
can do in polynomial time in the number
of electrons
what a supercomputer takes exponential
time to do
and it can do it better in that time
so in less time it can do better
uh and when you get to a number of
electrons that's pretty small
overall uh in terms of like active space
uh which is you know how to generalize
that
the electrons that matter the ones that
are
participating in chemical bonds when
you're at
40 60 80 of those still a pretty small
molecule
those calculations are hard you know
those calculations on a classical
computer take
hours and in your average
industrial discovery pipeline you don't
need to do five
you don't need to do ten you need to do
five million
and so there's really the benchmark the
future benchmark
as it were where quantum computers i
think
will really show their force
how much time do you expect for that
future
it's hard to put proper bounds on it
because it's hard to
predict innovation but
um
i would be disappointed if it took more
than 15.
uh i'll i'll put that as my stamp
uh some people put it as short as five
some people are skeptical and put it at
about 50
but i for one will be quite annoyed if
i'm you know losing my hair and still
can't do that
amazing so we have one person who is
sharing that i
was asking how i want to know the secret
to your great enthusiasm
your talk is so lively
secret to my enthusiasm uh well
um one thing it's uh currently 1
45 in the morning here in sunny warm
michigan usa
so the secret to my enthusiasm right now
is that my girlfriend bought a lot of
expensive coffee and i've drank all of
it
amazing so uh right now we are running
out of time and i feel that there are so
many questions that i
uh need to ask uh but we have to stop
here
and uh can you uh so
for so to take this forward
uh we will share can you share this
github link you
talked about and also this book name
and this edx course that you code it so
that people
can get started we'll share that on our
github page
uh and we'll share the with the audience
other than that
second thing uh can we i think that
that will be the time when we have um
prepared for asking more questions
if in the audience uh they have any
questions
related to the talk they can ask here
and probably we can
take those questions via probably on a
github discussions
and then take it forward now
do you have any last message to share
for the audience before we close this
session
i think not thank you
thank you sumner for joining us glad to
be here
see you bye
you
