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