#158: Quantum Computing and Python Transcript
00:00 You've surely heard of quantum computing and quantum computers. They're based on the often
00:04 non-intuitive nature of very small particles described by quantum mechanics.
00:08 So how do they work and what will they mean for us as a society and as developers? Luckily,
00:13 I have Hannah Sim, a PhD student from Harvard working on quantum algorithms,
00:18 here to give us the full story. This is Talk Python to Me, episode 158, recorded April 17,
00:23 2018.
00:25 Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries,
00:43 the ecosystem, and the personalities. This is your host, Michael Kennedy. Follow me on Twitter,
00:48 where I'm @mkennedy. Keep up with the show and listen to past episodes at talkpython.fm,
00:53 and follow the show on Twitter via at talkpython. This episode is brought to you by Linode and
00:59 ActiveState. Check out what they're offering during their segments. It really helps support the show.
01:03 Hannah, welcome to Talk Python.
01:05 Hi, thanks for having me, Michael.
01:06 Yeah, it's really great to have you here. I'm super excited about the topic that we're going to cover,
01:10 quantum computers and a little bit of quantum mechanics even. So that's going to be so fun.
01:16 But before we get into those topics, let's start with your story. How'd you get into programming in
01:20 Python? During my first year of college, I was really trying to decide. I knew I was interested
01:25 in chemistry, but I was, I guess, trying to decide what type of research or lab I wanted to join.
01:30 And I recall really liking the idea of integrating chemistry with computation. And this comes from the
01:38 fact that by using computational chemistry, you can essentially probe what's happening inside a test
01:44 tube or a beaker in lab and really understanding what's happening down at the molecular level.
01:49 Yeah, there's so much that seems almost unknown in chemistry. I mean, we have really, really clear
01:55 models for what it looks like if I throw a ball across the room. But understanding how, say, electrons
02:02 actually interact and stuff, that starts to get a little tricky, right? So these computational
02:07 approximations and stuff become important.
02:09 Exactly. And I guess the project that I was working on in undergrad was using classical molecular
02:14 dynamics. Just because these quantum mechanical calculations are so expensive, we need to make
02:19 these classical approximations. And I use these types of simulations specifically to study protein DNA
02:26 interactions.
02:27 Wow. So you went like really into the hard problems, right? It wasn't like, you know, how does the electron
02:32 move around benzene? But like, let's go for DNA and proteins and stuff like that, right?
02:37 Yeah, I guess they're both very hard problems. It's just coming from it at a different point
02:42 of view, I guess.
02:43 Yeah, yeah.
02:44 Yeah. And I guess at this point, I hadn't taken any formal computing or programming courses. But I just
02:50 kind of more or less taught myself programming in Python just by playing around and scripting and
02:56 using Stack Overflow.
02:57 Yeah, it doesn't matter what skill level you're at, whether you're just getting started or you're
03:02 a complete professional, Stack Overflow will be involved in the process.
03:05 Oh, definitely. Definitely.
03:07 That's really cool. So I'd like to ask you a little bit about this learning to program at this stage,
03:11 because a lot of folks, especially sort of in government and stuff, they'll say, well, we need
03:16 to teach people programming, because programming is an important skill. And I feel like a lot of these
03:22 initiatives are trying to just create more programmers. But you know, here you've come and
03:27 you've learned programming just to solve just basically to be a better chemist, right?
03:31 Exactly. Yeah.
03:33 Yeah, I think it's I think this is a really interesting use case just to kind of highlight or like experience
03:38 the highlight because so many people think, well, we're going to make a bunch of programmers. And I
03:42 think actually, what we need is to make super powered people that do other stuff and superpower them
03:47 with programming.
03:48 Yeah. And especially these days, there are so many available kind of learning platforms you can use
03:54 online. But I realized that there's a real difference between just understanding how,
04:00 say, like Python syntax works versus kind of knowing the art of modeling and programming.
04:06 For sure. You know, programming, especially in Python, because you can get started pretty quickly,
04:10 right, is one of these things that like, you feel like you're starting to you kind of learned it in
04:15 a week or two. But then, you know, 10 years later, you're still learning something every day.
04:19 Exactly. Yeah.
04:20 Nice. So now you're in grad school, right?
04:23 Yes. I'm a second year grad student at Harvard with Professor Alana Spurguzik.
04:29 Nice. And what are you studying there?
04:31 So right now, I'm doing a PhD in chemical physics. But I guess part of our research group really
04:37 focuses on developing new quantum classical algorithms for implementing on current or near
04:43 term quantum computers, which I'll, of course, talk about a little more later.
04:46 Yeah, quantum or near term quantum computers. I think this is super, super interesting. How many
04:52 people work in your research group?
04:53 So we're a pretty big group, I'd say around 30 people, but around a third of those people work on
04:59 quantum algorithms.
05:01 Yeah. So I guess, day to day, what kind of stuff are you doing? Are you like,
05:05 writing algorithms? Are you trying to create hardware? What are you doing? Scrambling to
05:11 finish qualifying exams?
05:12 I've already gotten past that, luckily.
05:14 Good for you. That's a big step.
05:16 But yeah, like you said, we're either as a group kind of trying to come up with the next new quantum
05:22 algorithm. But like I said before, because we're working with current or near term quantum
05:27 processors, we really, there are some constraints that we need to consider, such as how qubits
05:32 will respond to the noise and just the limitations and the number of these quantum bits or their
05:38 limited connectivities on the actual device and seeing how that will affect the types of algorithms
05:44 that we can come up with.
05:45 Yeah, that's really interesting because it's not just the bit is on or off. It can be many things.
05:50 Yeah.
05:51 Exactly.
05:51 Yeah. I'm really looking forward to digging into the quantum computing aspects because
05:56 it's still sort of a little bit beyond my understanding. But I think an important foundational
06:03 item maybe we should cover because, you know, most people listening are programmers, data scientists,
06:07 or maybe biologists or astrophysicists. But, you know, none of those groups necessarily
06:12 study quantum mechanics per se. Everybody's heard of quantum mechanics because,
06:18 you know, just pop culture. But, you know, maybe we could just talk real briefly about,
06:22 like, what is quantum mechanics as an area of physics?
06:26 To be very honest, it's like quantum mechanics is something that no one will ever fully understand,
06:32 just going in. I guess to put it broadly, you can think of it as a physical theory that describes
06:39 what happens in nature at the atomic or subatomic scale. Like you mentioned before,
06:44 just how electrons kind of move around and interact. That's really captured by quantum mechanics.
06:51 And to kind of contrast this with classical mechanics, where you can essentially, again,
06:58 you've already mentioned this example, but we can really predict where, say, something like a tennis
07:03 ball will be at some time T. But in quantum mechanics, we're really gaining an intuition of the
07:09 probability of finding a quantum particle at these various locations.
07:13 Yeah. So it's way more statistical driven than it is just measurement, right?
07:19 Right, right.
07:19 So when do we reach, like, where do I find quantum mechanics? So obviously, planets don't behave
07:27 quantumly. People don't behave quantumly. My little Apple ear pod thing, probably still too large,
07:34 right? A grain of sand, smaller? How small does it get? Like, where do you go? Like,
07:39 okay, we have to start thinking about like, forget, or start to at least factor in these quantum
07:43 mechanical principles rather than just say, like, Newton type stuff.
07:48 You're right in that all of these things that you've mentioned are classical particles, but we do
07:52 kind of use quantum mechanics everywhere. For example, if you look at kind of break down the
07:58 percentage of where computing, I guess, including times and efforts spent on supercomputers go,
08:04 So there are really a lot of significant chunk of them goes into performing these chemistry
08:09 calculations or some type of modeling of physical systems. And of course, all of these calculations are
08:15 really important for drug discovery, materials design and other industrial processes. But to really
08:22 capture accurate results for these types of calculations, you need to have a good understanding of
08:29 what's happening at the atomic or molecular level. And this is where quantum mechanics is,
08:34 I guess, at this scale, you really can't capture these behaviors and properties without considering
08:39 quantum mechanics, right? That's where the classical stuff actually starts to fall down.
08:43 How interesting. I don't want to go through all the aspects of quantum mechanics, because this is a
08:48 programming podcast, not a science one. But what parts or aspects of quantum mechanics are relevant for,
08:56 say, quantum computers, right? Like we have Heisenberg's uncertainty principle,
09:00 we all know about Schrodinger's cat, like, what kind of stuff do we kind of, what are the essential
09:05 things we need to know, just as the foundation of thinking about quantum computers?
09:09 To kind of put a spin on that question, this can be really captured by kind of looking at the difference
09:16 between quantum computing and classical computing, because we do directly apply laws of quantum mechanics
09:22 mechanics at the level of the basic unit of computation, essentially how we consider this quantum bit or
09:29 qubit.
09:30 Right. In traditional programming, we have bits, and they can be on or off zero or one. What's a qubit?
09:37 Right. So quantum bit, it's a little bit more complicated, just in terms of how they can be
09:43 represented, and how different processes are effectively operations can influence the state of that qubit.
09:50 So I guess what I can say is, we as quantum computer scientists can observe and work with directly in
09:58 quantum computing are actually samples of probability distributions of finding each qubit in the zero or
10:04 one state. Often people say that this is like being able to access the zero and one state at the same
10:11 time. But I think there's just subtle differences between these two explanations.
10:16 Okay. So instead of being zero or one, it's almost like it can be anywhere in between those two
10:24 possibilities in sort of a statistical model.
10:28 Exactly. There's some probability that you'll find this qubit in the zero or one state. Yes.
10:34 That's pretty interesting. Now, with traditional computers, they're super small too, right? I mean,
10:41 like the dyes these days for like the modern Intel processors and other ones, they're like at the 14
10:48 nanometer range. And it's been a long time since I've studied chemistry, but I'm feeling like
10:53 a couple of nanometers, that's like the diameter of an atom, right? That's pretty small, isn't it?
10:59 Right, right.
11:00 So do traditional CPUs like the one in my MacBook now, do they have to think about quantum computing
11:08 when building those types of devices?
11:10 They are definitely approaching this quantum realm, if you will, according to this Moore's law. And I
11:16 think this is actually one of the big motivations behind quantum computing, where, as you said, as the
11:22 size of each transistor is getting really smaller and smaller, it will just approach a size in which we
11:29 can really no longer ignore the effects of quantum mechanics. And this is why some people are like,
11:36 oh, we might need a different paradigm of computing. And this is where quantum computing may step in.
11:42 Right. So as we get our general CPUs smaller and smaller and more focused, right, like,
11:47 we're getting to the point where we just can't pack in more stuff without effectively entering the
11:54 quantum realm. Am I understanding that correctly?
11:56 Yes.
11:56 Okay. I guess if we're talking about quantum computers at the lowest, lowest level,
12:01 we already talked about how you have qubits versus regular bits, and how we have the statistical
12:09 difference, which I'm not really, I understand what you're saying, but I don't understand how to do
12:14 computation with it. So maybe give us a sense of like, what does it mean to try to implement like
12:21 algorithms or computation, like down at that level? Like, how do these things really work?
12:25 So the model of computation that I work with every day is the gate based quantum computation. And this
12:32 is quite analogous to the, I guess, the classical circuit model, where you essentially have, you select
12:39 a number of qubits to work on. And then you kind of propagate the circuit through time by applying
12:45 different types of operations on it. But this time, instead of these logic classical gates,
12:50 like and and or, we're now applying these quantum gates that kind of obey these mathematics of quantum
12:57 mechanics.
12:57 What kind of gates do you get there? Like, and and or, that makes a lot of sense to me.
13:01 What does, give us some examples of the quantum gate?
13:04 Say that we start at the zero state in a quantum computer. So if you apply, say, Hadamard gate,
13:12 let's see, how do I, how do I?
13:14 How do you explain this over audio?
13:17 Right. So the effect of a Hadamard gate, you can think of it as turning this, just the zero state
13:22 into this even superposition of zero and one state. So this effectively means that it's equally likely
13:30 to find this qubit at the end of this application of the Hadamard gate in the zero and one state.
13:36 There's a 50% chance of finding it in the zero or one state.
13:41 This is pretty wild. I guess one of the things that I always hear when I hear about quantum computing
13:46 is it's like it can compute sort of inherently can compute many possibilities at once.
13:53 And regular computers, they don't do that, right? They just like go right down their path. And I mean,
13:58 obviously they'll do like weird things, like try to guess the rest of the computation based on,
14:04 you know, while they're waiting for some other part of the system, but that's not really the same
14:07 thing, right? That's just doing extra work quickly in order. So where does that sort of factor in or
14:14 where does that come from? Or is even that the right way to think of it?
14:17 Yeah, I think there is actually some common misconceptions about quantum computing in that
14:22 people think that it's, it's somewhat like parallel computing in some sense, right? Just being able
14:28 to access all possible states at the same time. But I wouldn't say that that's entirely accurate.
14:36 It's just that, again, like I said, because we're kind of working with this evolution of this probability
14:42 distribution, in some sense, you're not just working with a discrete state, but you're able to kind of
14:49 affect a, you're effectively working with this distribution instead of a single state.
14:58 This portion of Talk Python to me is brought to you by Linode. Are you looking for bulletproof hosting
15:03 that's fast, simple, and incredibly affordable? Look past that bookstore and check out Linode at
15:07 talkpython.fm/Linode. That's L-I-N-O-D-E. Plans start at just $5 a month for a dedicated server
15:15 with a gig of RAM. They have 10 data centers across the globe. So no matter where you are,
15:19 there's a data center near you. Whether you want to run your Python web app, host a private get server,
15:25 or file server, you'll get native SSDs on all the machines, a newly upgraded 200 gigabit network,
15:32 24-7 friendly support, even on holidays, and a seven-day money-back guarantee. Do you need a
15:37 little help with your infrastructure? They even offer professional services to help you get started
15:42 with architecture, migrations, and more. Get a dedicated server for free for the next four months.
15:48 Just visit talkpython.fm/Linode. When I see quantum computing applied right now,
15:55 there's two areas that I hear it applied quite a bit, at least as much as it is applied. One of those
16:01 seems to do around solving science problems. You're a computational chemist person, and you're
16:08 studying this, right? That's very much in that space. And the other one I hear it all the time
16:14 is cryptography. And if people get quantum computers working, cryptography is broken. We all suggest,
16:21 you know, go get a cabin or something like that and live in the woods. So what kind of problems would
16:26 you say are like especially well suited for being addressed by quantum computers?
16:30 First of all, I think this is a very good question, because I think it's worth noting that quantum
16:35 computers will not be able to solve every problem exponentially faster than classical computers can.
16:41 So like you said, there are some kind of types of problems that quantum computers will be good at or
16:48 are well suited for. And that includes this factoring problem, which has applications in cryptography,
16:54 like you mentioned, quantum chemistry and Hamiltonian simulation. Others include combinatorial optimization
17:01 and possibly machine learning, with the intuition that maybe quantum computers can be used to
17:09 effectively capture complex patterns and data. That's really interesting. So that's definitely one
17:14 of the areas that I didn't just mention, but it certainly is on my radar is like quantum computers could be
17:21 a game changer for machine learning. Let's take them in order though. Let's, let's talk about the,
17:26 the sort of straight computational stuff. Like I want to model a bridge really, really well, or I want to
17:32 try to understand, you know, this sort of scientific problem better. And instead of doing approximations,
17:38 like maybe even weather, right? Maybe like climate science, maybe we can get like a truly accurate
17:43 forecast for like a hundred days or something like that with quantum computers. How does quantum computing help
17:49 like complex computation like that?
17:52 The problem that you came up with such as bridges, I'm a little less clear on how quantum computers can directly help
17:59 near term at least.
18:00 I'm just throwing stuff out there. I don't really know computers that well.
18:03 So well, maybe going back to problems in chemistry, right? There's this idea that because you can think of molecules
18:12 essentially as a system of quantum particles, there's a better map that you can use in order to kind of map
18:19 this problem onto the quantum computer where maybe each qubit represents some, some type of a orbital.
18:25 And in that case, by kind of evolving this quantum state on your quantum computer,
18:30 you're effectively modeling this molecule. And by doing so, the medium is like inherently more suited to modeling stuff that behaves like it does.
18:39 Yeah. But I guess this is still very much a, it's a rapidly developing field, but there's so many
18:45 open questions like how do you map quantum system to a more general problem? And that's very much an
18:51 active area of research.
18:53 So with machine learning, right, machine learning is going through dramatic changes. And I think one of
19:00 the areas where it's gotten super, super advanced is the different types of computation already being
19:07 applied to machine learning. So what I mean is, for a long time, the stuff was done just on
19:12 general purpose CPUs. And then it was moved over to GPUs where you could do way more work and have a
19:20 better model. And then now it's finding its way over to things like tensor processing units and stuff like
19:25 that coming out of Google. So do you see that that maybe keeps going into the quantum realm with some
19:32 of the stuff?
19:33 Adding on to the name, I guess, now you can think about QPUs, right? And as I mentioned earlier,
19:40 this kind of quantum circuit model, I think right now, one thing people are thinking about is using a
19:46 quantum circuit as some type of, let's say, a quantum neural network where you're training these parameters
19:53 on these quantum gates in order to, I guess, represent some type of model that can describe
20:00 some data. But I guess there's a lot of work being done on quantum machine learning, but it's,
20:07 again, still pretty early in its stages. So I think we're trying to really kind of figure out as a
20:13 community what quantum machine learning means even. Does this mean that we're working with
20:19 a classical data or quantum data or maybe both? There are lots of open questions.
20:24 Well, I think part of the problem is we don't understand how normal learning,
20:27 human or animal learning works all the way, right? And so our models are just like pokes in the dark,
20:34 right? Like we are not like, well, this is how it works in people and brains. So here's how we're
20:37 doing computers. It's like, well, we don't know that either. So let's try this.
20:40 Yeah. And add quantum to that equation and add two things that we don't fully understand.
20:45 And we don't know.
20:47 I feel like computers are going that way in general, the computers and software,
20:51 even before we talked about quantum computers, is that software is getting further to a place where
20:57 it kind of defines itself and it builds itself up and it can do things that we don't necessarily,
21:04 we can't ask it for a justification of why it did that thing. It just, we gave it some examples and
21:09 now it does things that seem mostly right. And quantum computing seems like it's just going to take us
21:14 farther down that realm of like, well, it works. Why? I don't know, but it really, it works really well.
21:20 Yeah. No, definitely. Definitely.
21:23 Yeah. So do you think what it means to be a programmer is going to be different in 30 years?
21:26 Right. Even thinking about what a quantum software engineer means currently, I'm still trying to
21:33 kind of figure that out because I feel like that's the type of profession or career I want in the
21:38 future. But what do you have to kind of do to prepare for this position? Right. How do you prepare
21:43 for a position that's not fully defined yet? Exactly. Yeah.
21:46 I would say you're way in a better place than most people though right now. Quantum computing research
21:51 lab at Harvard is definitely like one of the places I would think might help you on that path.
21:56 I hope so. I hope so.
21:57 That's pretty cool. So I know what it means to build reliable software in the traditional
22:06 sense of computing, right? Like, cause it's with the exception of parallel, like true parallel
22:13 execution, which throws its own things in there, which by the way, I think it's interesting that
22:18 the bugs created in parallel programs, traditional form often get called Heisen bugs,
22:24 which are, are borrowed from the whole quantum mechanics world, right? Like, you know, you observe
22:30 it, it changed the timing of the race condition and the race conditions gone, but you stop observing
22:34 and it comes back, things like that. I know with the exception of like the race conditions,
22:39 what for standard programming, what it looks like to build reliable software, unless the underlying
22:45 hardware is broken. Basically, once you get it working, it stays working. Like what's the story
22:53 with quantum programs? Like it sounds like if it's statistical based that it's mostly okay, or is it,
23:00 can we get to a place where it is fully deterministic in the same sense that we have now?
23:05 I think the power of quantum computing comes from the fact that it's not deterministic. I mean,
23:11 this is a real challenge that, we need to kind of find ways to efficiently sample from these
23:19 distributions of possible states.
23:20 So like in networks and stuff, we have like error checks and ways to sort of retry if something goes
23:26 wrong. Could we have something like that in computer and quantum computing where it's like, well,
23:32 while we ran this, we also ran like a, some sort of a checksum type thing and that failed.
23:36 So we're just going to rerun that computation at this step.
23:39 I have to say, I'm not too familiar with this area, but I think there is some methods for,
23:45 I think we call it a post-processing where, like you mentioned before, if you get an outcome that
23:50 you know is wrong, then you kind of ignore that run and then keep going through these or propagating
23:56 these quantum circuits until you get to an outcome that you know is right or is reliable.
24:02 Yeah. I just wonder if there's a way to like weave in like a known computation that it has to come
24:08 out with the same answer. And then you also get the thing you're actually trying to compute. And if
24:13 they're either going to be both broken or both. Okay. I don't know. Like I've not done any quantum
24:17 programs. I don't really know. I'm just trying to imagine how like you build reliable stuff out of this.
24:21 Yeah. And that's still very much a challenge just because quantum bits or qubits themselves are
24:26 still quite sensitive to noise. So it's hard to really check if the fault is coming from your
24:33 program or from the noise on the qubits. Yeah. And all these things are pretty experimental,
24:38 right? Like I haven't been to Best Buy for a while, but I didn't see any quantum computers. Like I saw,
24:43 they have a little Apple section and they have a bunch of Windows machines. I haven't seen any Linux
24:47 stuff over there, but you can go buy regular computers, but you can't go get quantum computers.
24:53 And so would you say that quantum computers exist today or they're just research projects that are
24:58 like poking at this concept of it? Like how far down this quantum computer path are we?
25:02 So I would say that definitely, yes, quantum computers exist today. And there are different
25:09 types of architectures that implement this. That being said, it's not like, like you said,
25:15 you can walk into a store and buy a quantum computer. And because of this, what's really
25:20 happening is that a lot of academic institutions and companies, they basically have these large
25:25 refrigeration units that are cooled down to very, very low temperatures. And this is where the qubits
25:31 reside. And because like I said before, that qubits are very delicate and sensitive to noise. There are
25:38 lots of scientists and engineers kind of trying to every day working to maintain these qubits.
25:44 But in order to make these quantum computers work and at the same time have them accessible to the
25:50 public so that they can try programming on these quantum computers. I think one way that they figured
25:55 this out is to have it through the cloud where anyone around the world can just kind of submit
26:00 these quantum program jobs.
26:01 Right. Yeah. People have said that sort of cloud computing is a little bit like jumping back to the
26:10 whole, like, you know, fire up a terminal dial into some big mainframe type of experience,
26:16 right? For a long time computing sort of moved to the desktop. And now in some sense,
26:21 it's kind of moved back to like the new modern mainframe. So you can take advantage of just all the scale of the
26:28 data centers. And it seems like that's the perfectly reasonable solution, at least in the early days
26:33 for these quantum computers is like they'll live in some special place underground away from other
26:39 interference, like really, really cold. And then we can like schedule jobs on them kind of like AWS Lambda
26:45 or something, right?
26:46 Yeah, I actually submitted some jobs on Rigetti computing's 90 qubit chip last weekend. And it was
26:54 very exciting. That's a theory. Yeah, that's super cool. All right. So you said computer quantum computers exist.
27:00 And can you give us some examples? So there's Rigetti. I heard IBM has something I've early days. I heard D wave.
27:08 I think I saw like a Nova show on D wave or something a long time ago. Maybe give us a rundown of some of these systems.
27:15 Like you said, Rigetti computing has their qubit processor, IBM, Google, Microsoft, but also a lot of academic institutions
27:22 have their own chips. And right, the D wave. The D wave is actually also how I first found out about this idea of quantum computing.
27:31 Because I think D wave was one of the first mainstream machines that were covered by media in order to really discuss this new technology called quantum computing.
27:42 Right. There was this concept of quantum computing, but then to actually see this thing, which is pretty interesting.
27:48 And it only had just like two bits or something like it was really, really not a massive computing system, but it was working right in the early days.
27:57 Right.
27:58 That's pretty awesome. Then there's the IBM 50, right?
28:04 So what's the story of that one?
28:05 So I believe they have a 50 qubit superconducting chip. I haven't actually had any experience programming on it, but I can say in general for IBM and these other major companies, often what they'll have are these quantum processors, but also their own kind of in-house quantum programming packages that they come with.
28:29 Any user can kind of play around with creating these quantum circuits and try running them on these qubit chips.
28:36 That's a pretty interesting question. Like if you have this entirely different way of thinking about programming and modeling, right?
28:43 Like when I sit down to program in Python, like it's all about if this, if not that, while that, you know what I mean?
28:52 Like it's all based on the and or gates. And so the programming languages are going to be really different.
28:57 But before I ask you about that, I want to actually ask you one other thing.
29:00 So you said there's the Regetti 19 qubit system, the IBM 50 qubit system.
29:05 I have a 64 bit Intel core seven or whatever.
29:12 How do I relate? Like, how can I relate the number 16 or 50 to what I know in terms of like regular CPUs?
29:20 Is there a relationship? What is it?
29:22 This is a good question. I have to say in classical computers at this point, you know, the common user like myself, when I program, I really don't have to worry at the level of if the bit is undergoing some noise process.
29:36 And if there's any like bit flips that I'm worrying about, there are these like error correction codes and these redundancy checks that are in place.
29:44 But for quantum computers, I think we're still at the stage where we can't kind of ignore these effects.
29:51 So when we say these 19 qubit chips, 50 qubit chips, these qubits are actually physical qubits that haven't been.
29:58 So we don't have enough qubits in order to fully kind of implement these quantum error correction codes,
30:05 such that when we run these quantum programs, we know with great probability that our program will run reliably, so to say.
30:14 There will be a lot of noise that undergo and the computation or the result that we get at the end.
30:20 We don't know if there has been some like various bit flips and other noises that happened.
30:25 I guess right now it's a little too early for like a direct comparison.
30:29 Sure.
30:30 But it sounds like maybe they're not as fully leveraged as say the systems that we have.
30:37 Something to that effect, maybe.
30:38 This portion of Talk Python to Me is brought to you by ActiveState.
30:43 ActiveState gives you a faster way to build and secure open source runtimes from your first line of code through to production.
30:49 Every second you spend building your Python distro or trying to secure your Python programs
30:53 is less time spent doing the work you love.
30:56 You've got better things to do than trying to resolve dependencies or making sure that you tick off all security boxes when you ship to production.
31:02 Standardize on your Python builds so you can have less friction in the development cycle
31:06 and you can deliver apps faster.
31:08 You can also get a unique server-side way to verify your Python applications at runtime.
31:13 Bake security right into your code without impacting performance.
31:16 Go faster, spend more time doing the work you love, and comply with your enterprise security needs.
31:22 Try ActiveState and see why it was chosen by IBM, Microsoft, NSA, Siemens, PepsiCo, and more.
31:27 Join millions of developers who trust ActiveState to build their open source language distros.
31:31 Visit talkpython.fm/ActiveState for a special offer.
31:35 That's talkpython.fm/ActiveState.
31:40 We have this new programming model.
31:41 How do we program it?
31:43 Like I mentioned before, I think this is a great time to really get into quantum programming or quantum computing
31:50 because you have actually several choices of packages that you can use to program on a quantum device.
31:56 Some of them include IBM's Quantum Experience where they have some drag-and-drop interface
32:01 in order to try to create your own quantum program.
32:04 Wow. Is it almost like Scratch or something like that?
32:08 Yeah, you could think of it like that.
32:10 I played around with it a little bit and it's quite fun.
32:13 Besides that, they have their, I guess, non-drag-and-drop software package called Qiskit.
32:18 Okay.
32:19 I think Rigetti Computing has Forrest.
32:22 Their platform is called Forrest, but their programming language is called Quill.
32:26 I think Microsoft has Qsharp.
32:29 And Google actually has a package called OpenFermion, which is a package that can be used to develop quantum algorithms
32:37 specifically for fermionic or essentially molecular systems.
32:40 So that's, of course, one of my favorites.
32:43 Yeah, of course.
32:44 Those all sound really interesting, but none of them sound very familiar, right?
32:49 Like the only one that I've really looked through the programming model of
32:54 was the Qsharp one from Microsoft.
32:56 And that's because it actually has interesting Python tie-ins.
33:01 But most of these that you mentioned actually have some way to interact with them from Python, right?
33:05 Yes.
33:06 Yeah. So tell us about that relationship.
33:07 I guess I've mostly played around with Rigetti Computing's PyQuil, where you essentially, right now, a Python program,
33:16 you'd have these Python functions for these quantum gates.
33:19 And what you're doing is kind of initiating a quantum circuit by inputting the number of qubits you want in a circuit.
33:25 And then you can basically place different gates in different parts of the circuit
33:31 in order to perform the computation you want or alternatively produce a quantum state that you want.
33:37 And they have these different backends where one backend could be a simulator
33:41 where you can kind of look at how the wave function or the quantum state is evolving as you propagate your circuit.
33:48 But then another backend is when you directly now communicate with the actual quantum computers,
33:55 maybe for Rigetti in Berkeley or something, where after you write this quantum program in Python,
34:01 you can just directly send it to the machine to run.
34:04 That's pretty awesome.
34:06 You mentioned the simulators, right?
34:08 There's only a handful of these computers.
34:11 What do they cost?
34:12 If I wanted to, I don't even know if it's possible, but if I wanted to go buy, say, the D-Wave,
34:17 I'm a real big enthusiast, and I want to put into my garage the IBM 50, what would that cost?
34:25 It depends on what your job is.
34:27 Because you're going to need a lot of money.
34:29 Yeah.
34:30 Luckily, I think in the US, at least, there's this real initiative to kind of get quantum computing going
34:37 and have it more accessible to the public.
34:39 So I wouldn't be surprised if a lot of these kind of national labs start investing in quantum computing
34:46 and even purchasing these machines.
34:48 Sure.
34:49 So a long time ago, IBM had their mainframes, and Bill Gates and crew came along and said,
34:55 no, we're going to have a computer on every desk.
34:57 Things like that effect.
34:59 And there's some quote, I think it was from the IBM people, like, how many computers do there need to be in the world?
35:03 Like nine, maybe 10?
35:04 I don't know.
35:05 Right.
35:06 And it's probably like that way now for these quantum computers, right?
35:11 There's like one or two of each of the ones you've named.
35:13 I don't know.
35:14 Not too many.
35:15 But I feel like this time, because of all the infrastructure needed to say,
35:19 keep it cool, keep it away from interference with other sorts of radiations and interactions,
35:25 like it might actually stay in the cloud only.
35:29 Do you think that we'll ever have quantum computers, like just in laptop form?
35:35 Or is this something we're always going to connect to over services?
35:38 I mean, of course, right?
35:40 Having your personal quantum computer is the dream.
35:43 But like you said, there's still quite a way to go before we can really find ways to consider these noises
35:50 and maybe avoid these necessities for cold conditions.
35:55 Right now it's super cold.
35:57 Like how cold does it have to be?
35:58 Like you don't want to touch it cold, right?
36:00 Yeah, like millikelvin.
36:02 Millikelvin.
36:03 Yes, close to absolute zero, which is, yeah.
36:06 But that being said, I mean, even with classical computing, you know, when you mentioned this IBM quote,
36:12 at that point, I'm sure there were a lot of skeptics and people who were like,
36:17 oh, I don't know if that's going to be achievable.
36:19 But hey, like today, we did achieve that.
36:23 So maybe for quantum computers, new technologies will kind of come in and new research scientists will find ways in order to make quantum computing more accessible.
36:32 Right.
36:32 Maybe some material science problem is solved that requires only liquid nitrogen level cold,
36:40 not millikelvin cold.
36:41 Exactly.
36:42 Interesting.
36:44 Yeah.
36:44 And we also have simulators, right?
36:46 So not everybody has access to these machines.
36:48 But I know that at least the Qsharp one, because I looked through their documentation,
36:52 they have like a literal simulator that you can go and write your programs from Python or Qsharp or Jupyter or whatever,
37:00 however you want to do on that thing.
37:02 Like you can go write your programs and simulate it.
37:06 Is that pretty common these days?
37:07 Yeah.
37:08 So I've been actually working with Regetti's PyQuil simulator, and I think a lot of them work pretty similarly.
37:14 And this type of tool or framework is really important for theorists.
37:19 And just because we're kind of looking to develop algorithms for near term computers,
37:25 but at the same time, we want to do something useful.
37:27 So in some sense, we want to assume these like error corrected qubits.
37:32 Yeah.
37:33 So how accurate is this, right?
37:34 Like it is a simulator, and you're simulating things that we have a hard time fully contemplating.
37:41 Like if I write some program and get it working on the simulator, how close is that to working?
37:47 Like how, what's the difference in say performance, things like that?
37:50 At this point, it would be great if the simulator that you're using has some way of creating noise
37:56 or accounting for noise in your simulation.
37:59 And assuming that you have a good enough noise model, I think the result that you get should be pretty comparable to experimental results.
38:08 Okay.
38:08 That's encouraging.
38:09 What about performance?
38:10 It depends on what you're doing maybe, right?
38:13 Right, right.
38:13 Because right now, like I mentioned before, these like experimental setups,
38:17 you know, there has to be a group of engineers and scientists that are trying to really optimize these operations
38:23 in order to kind of perform a calculation using the actual quantum device.
38:29 So when we talk about maybe runtime or some type of performance measure like that,
38:34 it's hard to compare really directly right now.
38:37 But I guess at least simulations take way shorter and takes less manpower.
38:43 I say it's similar to how other fields in computational science works, where theory and experiments kind of go hand in hand and help each other kind of advance.
38:54 Yeah, I definitely think it's cool that these simulators exist because there's not that much access to even,
39:01 you know, these limited quantum computers we have.
39:03 So definitely lets people do research and explore and test.
39:07 Mm-hmm.
39:08 Nice.
39:08 Okay, so let me ask you some sort of slightly higher philosophical questions about quantum computing.
39:14 What are the things to really get excited about?
39:17 Like what's going to be invented?
39:19 What is going to be possible that is not possible now because of quantum computing?
39:24 What do you see on the horizon?
39:26 We've already kind of discussed the possible applications of quantum computing.
39:31 But I think just looking at the field itself, even now, I think research or development,
39:37 they're all moving very fast in quantum computing.
39:40 But at the same time, I'd say this is a good time for people to get into quantum computing
39:45 because there's just so many open questions that you can ask.
39:49 And quantum computing is one of those fields where people from various backgrounds,
39:54 such as math, physics, chemistry, engineering, and computer science, they can really all get involved and significantly contribute.
40:02 Yeah, that's really cool.
40:04 I feel like so much of what is sort of sold as a college degree of computer science
40:11 is much more just software engineering.
40:14 And the actual science part of it is not so much there.
40:18 But this seems like a place where computer science still is like very much the experiment,
40:23 explore, hypothesis, and test stage rather than we just go through like,
40:28 you know, we're using unit testing in Scrum and we're going to do that.
40:32 And here's how we, you know, factor our database and whatnot.
40:34 Right.
40:35 No, it seems pretty cool.
40:36 So what about energy, right?
40:39 Like energy consumption by data centers is actually really huge because we never see them, right?
40:45 There are these giant places in just a few spots on the globe, right?
40:49 I think the closest data center to me is Prinnville, Oregon, which is out by, and this literally,
40:55 the reason it is there is it's by one of the dams in the, I believe the Columbia River,
41:00 so that it has like close access to lots of power.
41:04 Right.
41:05 Right.
41:05 And so the traditional CPUs take a ton of power to exist and do their work.
41:10 How does that work in the quantum computing world?
41:13 Like if we got a really well working quantum computer, would it use less energy?
41:18 Would it use more?
41:19 What do you think?
41:19 I think as a theorist, I have much less of an intuition for these types of questions.
41:24 But given that, I actually talked to one of my colleagues who is an experimentalist, and
41:29 he mentioned that at least for certain types of qubit architectures, such as superconducting
41:35 qubits, they do expect less power consumption per qubit.
41:39 Okay.
41:39 That's pretty encouraging.
41:40 Compared to the classical.
41:41 Yeah.
41:42 And I don't know the numbers, but I know that some problems are solved immensely faster
41:48 by quantum computers.
41:49 So, you know, maybe it even takes more energy, but it could solve it a thousand times faster.
41:54 So in the long run, maybe it's, you know, way, way more efficient.
41:57 So there's interesting trade-offs on that angle too, I would suspect.
42:00 That's true.
42:01 Because I guess that's where you're like, in classical computing, you probably won't ever
42:06 find it or get to the answer within the time of the universe.
42:10 But for quantum computing, maybe it'll be possible.
42:12 Right, right.
42:14 But I feel like, you know, that's awesome and that's probably going to happen.
42:17 But at the same time, like, we'll just ask more complicated questions and we'll ask them
42:21 more often.
42:21 So it'll open up what we can do more with the various watts we got around, but it probably
42:28 won't make any significant difference, I guess.
42:30 It's pretty cool though.
42:31 So it's all pretty exciting.
42:33 Like, are there things that we should be concerned of?
42:36 You know, I mentioned like cryptography, getting in a cabin, checking out a society sort of
42:41 thing.
42:41 What should, I guess, we be careful of or just like, what would maybe be not a great consequence?
42:48 Regarding this like loss of privacy, perhaps that people fear.
42:52 I think quantum computing will actually help with that fear in some sense because of these
42:58 proposals for different types of quantum key distribution protocols or just in general, how
43:05 quantum computing will help cryptography.
43:07 Even in some of the standard encryption conversations these days, I hear people talking about like
43:13 quantum safe algorithms that are sort of resistant to being cracked by quantum computing techniques
43:21 that are different than say, just depending upon exchanging primary key, primary numbers,
43:25 primes.
43:27 But do you have any experience with these?
43:29 Do you know what that's about?
43:30 I've definitely heard of them, but I don't think I have enough expertise to say anything.
43:35 Sure.
43:35 I'm just trying to understand like, what is that, you know, what does that algorithm look
43:38 like?
43:39 How, like, how do you implement something like that?
43:41 That is just, I don't know, a problem that would be not so easily solved by quantum computing
43:45 and pretty, pretty interesting.
43:46 But just going back to if we should.
43:48 Should we be worried, right?
43:49 Like, it sounds like maybe there'll be this like rough patch while we transition algorithms,
43:55 but maybe in the long term, quantum computing doesn't necessarily mean bad stuff for encryption
44:00 and privacy.
44:01 Yeah.
44:01 And I just want to say, like, as with all technologies, I think we always need to be
44:06 wary of where and how this new technology will be used.
44:09 But I think given that quantum computing is still very much early in its stages, and we're
44:16 trying to figure out how to really fully leverage its strengths and capabilities to do practical
44:22 tasks.
44:23 So I think those will be relevant questions, but just not right now.
44:27 Right.
44:27 We're a little too early for that.
44:29 Yeah.
44:30 Yeah.
44:30 Probably what will happen is we'll come up with these amazing quantum computers and people
44:34 will just use them to like animate GIFs, like with their head stuck on a cat or, you know,
44:39 something kind of like now.
44:42 Yeah.
44:42 All right.
44:43 So maybe we'll just leave it there for the quantum computers.
44:45 That's really interesting.
44:47 I have a slightly better understanding than I did before.
44:50 Thank you for sharing all that.
44:52 And of course, I'll put all the links to like the various computers and APIs and stuff in
44:57 the show notes.
44:58 So let me ask you the two final questions I ask at the end of the show.
45:01 Always.
45:02 If you're going to write some code, maybe some Python code to talk to a Rigotti server or
45:06 something like that, what editor do you use?
45:08 So I go back and forth between Sublime and Vim just because my dad was a software engineer
45:15 and he exposed me to Vim.
45:17 That's Vim from an early age.
45:19 Awesome.
45:19 All right.
45:20 How about a notable PyPI package?
45:22 Like many of these amazing things you've been talking about, you can literally pip install
45:25 them, right?
45:26 Yes.
45:26 Yes.
45:27 So I've already mentioned these two before, but of course, being a chemist, I really enjoy
45:32 using OpenVermion for basically implementing quantum chemistry algorithms for quantum computers,
45:38 as well as PyQuil, which I've mentioned earlier by Rigetti Computing.
45:43 Not only is it really well tested and documented, but it has a really great Slack community where you
45:49 can just post questions about the syntax as well as general questions about quantum computing.
45:54 Oh, very cool.
45:55 It's really nice to have these Slack communities or Gitter channels or whatever popping up
46:00 that you can actually get in touch really easily with people doing similar things in all specials.
46:04 Definitely.
46:05 Yeah.
46:05 Cool.
46:06 All right.
46:07 So it's not too early for people to get started with quantum computing.
46:11 Now you say you think it's a good time to get started, build some experience and like
46:15 play with some simulator, something like that.
46:17 Yes, definitely.
46:18 I encourage it highly.
46:19 All right.
46:20 Awesome.
46:20 Well, Hannah, thank you so much for being on TalkByThan.
46:23 Thank you, Michael.
46:24 Bye.
46:24 This has been another episode of Talk Python to Me.
46:28 Today's guest was Hannah Sim, and this episode has been brought to you by Linode and ActiveState.
46:34 Linode is bulletproof hosting for whatever you're building with Python.
46:38 Get four months free at talkpython.fm/Linode.
46:42 That's L-I-N-O-D-E.
46:44 ActiveState gives you a faster way to build and secure open source runtimes.
46:50 From your first line of code through to production, check it out at talkpython.fm/ActiveState.
46:57 Want to level up your Python?
46:58 If you're just getting started, try my Python jumpstart by building 10 apps or our brand new
47:03 100 days of code in Python.
47:05 And if you're interested in more than one course, be sure to check out the Everything Bundle.
47:09 It's like a subscription that never expires.
47:11 Be sure to subscribe to the show.
47:14 Open your favorite podcatcher and search for Python.
47:16 We should be right at the top.
47:17 You can also find the iTunes feed at /itunes, Google Play feed at /play, and direct
47:23 RSS feed at /rss on talkpython.fm.
47:26 This is your host, Michael Kennedy.
47:28 Thanks so much for listening.
47:30 I really appreciate it.
47:31 Now get out there and write some Python code.
47:33 I'll see you next time.