Brought to you by Linode - Build your next big idea @ linode.com


« Return to show page

Transcript for Episode #158:
Quantum Computing and Python

Recorded on Tuesday, Apr 17, 2018.

0:00 Michael Kennedy: You've surely heard of quantum computing and quantum computers. They're based on the often non-intuitive nature of very small particles described by quantum mechanics. So how do they work and what will they mean for us as a society and as developers? Luckily, I have Hannah Sim, a PhD student from Harvard working on quantum algorithms here to give us the full story. This is Talk Python to Me, Episode 158, recorded April 17th, 2018. Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the ecosystem and the personalities. This is your host, Michael Kennedy, follow me on Twitter where I'm @MKennedy. Keep up with the show and listen to past episodes at talkpython.fm and follow the show on Twitter via @TalkPython. This episode is brought to you by Linode and ActiveState. Check out what they're offering during their segments. It really helps support the show. Hannah, welcome to Talk Python.

1:05 Hannah Sim: Hi, thanks for having me, Michael.

1:07 Michael Kennedy: Yeah, it's really great to have you here. I'm super excited about the topic that we're going to cover, quantum computers and a little bit of quantum mechanics even. So that's going to be so fun. But before we get into those topics, let's start with your story. How'd you get into programming in Python?

1:20 Hannah Sim: During my first year of college, I was really trying to decide. I knew I was interested in chemistry, but I was, I guess, trying to decide what type of research or lab I wanted to join. I recall really liking the idea of integrating chemistry with computation. This comes from the fact that by using computational chemistry, you can essentially probe what's happening inside a test tube or a beaker in lab and really understanding what's happening down at the molecular level.

1:49 Michael Kennedy: Yeah, there's so much that seems almost unknown in chemistry. I mean, we have really, really clear models for what it looks like if I throw a ball across the room. But understanding how, say, electrons actually interact and stuff, that starts to get a little tricky, right? So these computational approximations and stuff are kind of important.

2:09 Hannah Sim: Exactly, and I guess the project that I was working on in undergrad was using classical molecular dynamics, just because these quantum mechanical calculations are so expensive, we need to make these classical approximations. I use these types of simulations specifically to study protein DNA interactions.

2:27 Michael Kennedy: Wow, so you went like really into the hard problems. It wasn't like how does the electron move around benzine but let's go for DNA and proteins and stuff like that, right?

2:37 Hannah Sim: I guess they're both very hard problems. It's just coming from it at a different point of view, I guess. I guess at this point I hadn't taken any formal computing or programming courses, but I just kind of more or less taught myself programming in Python just by playing around and scripting and using Stack Overflow.

2:57 Michael Kennedy: It doesn't matter what skill level you're at whether you're just getting started or you're a complete professional, Stack Overflow will be involved in the process.

3:05 Hannah Sim: Oh, definitely, definitely.

3:07 Michael Kennedy: That's really cool. So I'd like to ask you a little bit about this learning the programming at this stage, because a lot of folks, especially sort of in government and stuff, they'll say, "Well, we need to teach people programming because programming's an important skill." I feel like a lot of these initiatives are trying to just create more programmers, but, you know, here you've come and you've learned programming just to solve, just basically to be a better chemist, right?

3:31 Hannah Sim: Exactly.

3:31 Michael Kennedy: I think that's a really interesting use case to just kind of highlight or like experience to highlight, because so many people think, "Well, we're going to make a bunch of programmers." And I think actually what we need is to make super powered people that do other stuff and super power than with programming.

3:48 Hannah Sim: Especially these days there's so many available of kind of learning platforms you can use online. But I realize that there's a real difference between just understanding how, say, like Python syntax works versus kind of knowing the art of modeling and programming.

4:06 Michael Kennedy: For sure, you know, programming, especially in Python, 'cause you can get started pretty quickly is one of these things that like you feel like you're starting to, you kind of learned it in a week or two, but then 10 years later you're still learning something every day.

4:19 Hannah Sim: Exactly.

4:20 Michael Kennedy: Nice, so now you're in grad school, right?

4:23 Hannah Sim: Yes, I'm a second year grad student at Harvard with Professor Alán Aspuru-Guzik.

4:29 Michael Kennedy: Nice, and what are you studying there?

4:31 Hannah Sim: So right now I'm doing a PhD in Chemical Physics. But I guess part of our research group really focuses on developing new quantum classical algorithms for implementing on current or near term quantum computers, which I'll, of course, talk about a little more later.

4:47 Michael Kennedy: Quantum or near-term quantum computers. I think this is super interesting. How many people work in your research group?

4:53 Hannah Sim: So we're a pretty big group. I'd say around 30 people, but around a third of those people work on quantum algorithms.

5:01 Michael Kennedy: I guess day-to-day what kind of stuff are you doing? Are you like writing algorithms, are you trying to create hardware? What are you doing? Scrambling to finish qualifying exams?

5:12 Hannah Sim: I've already got and passed that, luckily.

5:13 Michael Kennedy: Good for you. That's a big step.

5:16 Hannah Sim: But, yeah, like I said, we're either as a group trying to come up with a next new quantum algorithm, but like I said before, because we're working with current or near-term quantum processors, there is some constraints that we need to consider, such as how qubits will respond to the noise and just the limitations and the number of these quantum bits or their limited connectivities on the actual device and seeing how that will affect the types of algorithms that we can come up with.

5:45 Michael Kennedy: Yeah, that's really interesting, 'cause it's not just the bit is on or off. It can be many things, yeah.

5:51 Hannah Sim: Exactly.

5:52 Michael Kennedy: I'm really looking forward to digging into the quantum computing aspects, 'cause it's still sort of a little bit beyond my understanding. But I think an important foundational item maybe we should cover, because most people listening to our program are data scientists or maybe biologists or astrophysicists, but none of those groups necessarily study quantum mechanics, per se. Everybody's heard of quantum mechanics because, you know, just pop culture. But maybe we could just talk real briefly about what is quantum mechanics as an area of physics.

6:27 Hannah Sim: To be very honest, it's like quantum mechanics is something that no one will ever fully understand just going in. I guess to put it broadly, you can think of it as a physical theory that this is what happens in nature at the atomic or subatomic scale. Like you mentioned before, just how electrons kind of move around and interact, that's really captured by quantum mechanics. And to kind of contrast this with classical mechanics where we can essentially, again, you already mentioned this example, but we can really predict where say something like a tennis ball will be at some time T, but in quantum mechanics, we're really gaining an intuition of the probability of finding a quantum particle at these various locations.

7:13 Michael Kennedy: It's way more statistical driven than it is just measurement, right?

7:19 Hannah Sim: Right, right.

7:20 Michael Kennedy: So when do we reach, like where do I find quantum mechanics? So obviously planets don't behave quantumly, people don't behave quantumly, my little Apple ear pod thing, probably still too large, right? A grain of sand, smaller? How small does it get? Like where do you go, like, okay, we have to start thinking about, forget, or start to at least factor in these quantum mechanical principles, rather than just say like Newton type stuff?

7:48 Hannah Sim: You're right in that all of these things that you've mentioned are classical particles, but we do kind of use quantum mechanics everywhere. For example, if you look at, kind of break down the percentage of where computing, I guess, including times and effort spent on super computers go, they're really, a lot of significant chunk of them goes into performing these chemistry calculations or some type of modeling of physical systems. And, of course, all of these calculations are really important for drug discovery, materials design and other industrial processes. But to really capture accurate results for these types of calculations, you need to have a good understanding of what's happening at the atomic or molecular level. This is where quantum mechanics is. I guess at this scale you really can't capture these behaviors and properties without considering quantum mechanics.

8:40 Michael Kennedy: Right, that's where the classical stuff actually starts to fall down. How interesting. I don't want to go through all the aspects of quantum mechanics, 'cause this is programming podcast, not a science one, but what parts or aspects of quantum mechanics are relevant for, say, quantum computers, like we Heisenberg's uncertainty principle, we all know about Schrodinger's cat. Like what kind of stuff do we kind of, what are the essential things we need to know as the foundation of thinking about quantum computers.

9:09 Hannah Sim: To kind of put a spin on that question, this can be really captured by kind of looking at the difference between quantum computing and classical computing, because we do directly apply laws of quantum mechanics at the level of the basic unit of computation, essentially how we consider this quantum bit or qubit.

9:30 Michael Kennedy: Right, in traditional programming we have bits and they can be on or off, zero or one. What's a qubit?

9:38 Hannah Sim: Right, so quantum bit, it's a little bit more complicated just in terms of how they can be represented and how different processes or effectively operations can influence the state of that qubit. So I guess what I can say is we, as quantum computer scientists, can observe and work with directly in quantum computing are actually samples of probability distributions of finding each qubit in the zero or one state. Often people say that this is like being able to access the zero and one state at the same time. But I think there's just subtle differences between these two explanations, yeah.

10:17 Michael Kennedy: Okay, so instead of being zero or one, it's almost like it can be anywhere in between those two possibilities in sort of a statistical model.

10:28 Hannah Sim: Exactly, there's some probability that you'll find this qubit in the zero or one state, yes.

10:34 Michael Kennedy: That's pretty interesting. Now with traditional computers, they're super small, too, right? I mean, like the dyes these days for the modern Intel processors and other ones, they're like at the 14 nanometer range. And it's been a long time since I've studied chemistry, but I'm feeling like a couple of nanometers, that's like the diameter of an atom. That's pretty small, isn't it?

10:59 Hannah Sim: Right, right.

11:00 Michael Kennedy: So do traditional CPUs, like the one in my MacBook now, does that... Like do they have to think about quantum computing when building those types of devices?

11:10 Hannah Sim: They are definitely approaching this quantum realm, if you will, according to this Moore's law. And I think this is actually one of the big motivations behind quantum computing, where as you said as the size of each transistor's getting really smaller and smaller, it will just approach a size in which we can no longer ignore the effects of quantum mechanics. And this is why some people are like, oh, we might need a different paradigm of computing. And this is where quantum computing may step in.

11:42 Michael Kennedy: Right, so as we get our general CPUs smaller and smaller and more focused, we're getting to the point where we just can't pack in more stuff without effectively entering the quantum realm. Am I understanding that correctly?

11:56 Hannah Sim: Yes.

11:57 Michael Kennedy: Okay, I guess if we're talking about quantum computers at the lowest, lowest level, we already talked about how you have qubits versus regular bits and how we have this statistical difference, which I'm not really... I understand what you're saying, but I don't understand how to do computation with it. So maybe give us a sense of like what does it mean to try to implement algorithms or computation down at that level? Like how do these things really work?

12:25 Hannah Sim: So the model of computation that I work with every day is the gate-based quantum computation. And this is quite analogous to the, I guess, the classical circuit model, where you essentially have, you select the number of qubits to work on and then you kind of propagate the circuit through time by applying different types of operations on it. But this time, instead of these logic classical gates like "and" and "or", we're now applying these quantum gates that kind of obey these mathematics of quantum mechanics.

12:58 Michael Kennedy: What kind of gates do you get there? Like "and" and "or", that makes a lot of sense to me. What is, give us some examples of the quantum gate?

13:04 Hannah Sim: Say that we start at the zero state in a quantum computer. So if you apply, say, Hadamard gate, let's see, how do I--

13:12 Michael Kennedy: How do you explain this over audio?

13:17 Hannah Sim: Right, so the effect of a Hadamard gate, you can think of it as turning this just the zero state into this even superposition of zero and one state, so this effectively means that it's equally likely to find this qubit at the end of this application of the Hadamard gate in the zero and one state. There's 50% chance of finding it in the zero or one state.

13:41 Michael Kennedy: This is pretty wild. I guess one of the things that I always hear when I hear about quantum computing is it's like it can compute sort of, inherently can compute many possibilities at once. And regular computers, they don't do that, they just go right down their path and obviously they'll do like weird things like try to guess the rest of the computation based on why they're waiting for some other part of the system. But that's not really the same thing, right? That's just doing extra work quickly in order. So where does that sort of factor in or where does that come from? Or is even that the right way to think of it?

14:17 Hannah Sim: Yeah, I think there is actually some common misconceptions about quantum computing and that people think that it's somewhat like parallel computing in some sense, just being able to access all possible states at the same time. But I wouldn't say that that's entirely accurate. It's just that, again, like I said, because we're kind of working with this evolution of this probability distribution, in some sense, you're not just working with the discreet state, but you're able to kind of affect a... You're effectively working with this distribution instead of a single state.

14:57 Michael Kennedy: This portion of Talk Python to Me is brought to you by Linode. Are you looking for bulletproof hosting that's fast, simple and incredibly affordable? Look past that bookstore and check out Linode at talkpython.fm/Linode, that's L-I-N-O-D-E. Plans start at just five dollars a month for a dedicated server with a Gig of RAM. They have 10 data centers across the globe. So no matter where you are, there's a data center near you. Whether you want to run your Python web app, host a private Git server, or file server, you'll get native SSDs on all the machines, a newly upgraded 200 gigabit network, 24/7 friendly support, even on holidays, and a seven-day money back guarantee. Do you need a little help with your infrastructure? They even offer professional services to help you get started with architecture, migrations and more. Get a dedicated server for free for the next four months. Just visit talkpython.fm/Linode. When I see quantum computing applied right now, there's two areas that I hear applied quite a bit, at least as much as it is applied. One of those seems to do around solving science problems. Like you're a computational chemist person and you're studying this, right? Like that's very much in that space. And the other one I hear all the time is cryptography. And, you know, people get quantum computers working, cryptography's broken, we all suggest go get a cabin, or something like that, and live in the woods. So what kind of problems would you say are especially well-suited for being addressed by quantum computers?

16:30 Hannah Sim: First of all, I think this a very good question, because I think it's worth nothing that quantum computers will not be able to solve every problem exponentially faster than classical computers can. So, like you said, there are some types of problems that quantum computers will be good at or are well suited for. And that includes this factoring problem, which has applications in cryptography, like you mentioned, quantum chemistry and Hamiltonian simulation. Others include common tutorial optimization and possibly machine learning with the intuition that maybe quantum computers can be used to effectively capture complex patterns and data.

17:12 Michael Kennedy: That's really interesting. So that's definitely one of the areas that I didn't just mention, but it certainly is on my radar as like quantum computers could be a game changer for machine learning. Let's take 'em in order there. Let's talk about the sort of straight computational stuff. Like I want to model a bridge, really, really well, or I want to try to understand this sort of scientific problem better, and instead of doing approximations. Like maybe even weather, right? Maybe like climate science. Maybe we can get like a truly accurate forcast for like 100 days, or something like that with quantum computers. How does quantum computing help complex computation like that?

17:51 Hannah Sim: The problem that you came up with, such as bridges, I'm a little less clear on how quantum computers can directly help near term, at least.

18:00 Michael Kennedy: I'm just throwing some out there. I don't really know quantum computers that well.

18:03 Hannah Sim: Well, maybe going back to problems in chemistry, right? There's this idea that because you can think of molecules essentially as a system of quantum particles, there's a better map that you can use in order to kind of map this problem onto the quantum computer where maybe each qubit represents some type of orbital. And in that case, by kind of evolving this quantum state on your quantum computer, you're effectively modeling this molecule. And by doing so--

18:34 Michael Kennedy: The medium is like inherently more suited to modeling stuff that behaves like it does.

18:39 Hannah Sim: Yeah, but I guess this is still very much a, it's a rapidly developing field, but there's so many open questions like how do you map quantum system to a more general problem? And that's very much an active area of research.

18:52 Michael Kennedy: So with machine learning, machine learning is going through dramatic changes and I think one of the areas where it's gotten super, super advanced is the different types of computation already being applied to machine learning. So what I mean is for a long time this stuff was done just on general purpose CPUs. And then it was moved over to GPUs, where you could do way more work and have a better model. And then now it's finding its way over to things like tensor processing units, and stuff like that, coming out of Google. So do you see that that maybe keeps going into the quantum realm with some of the stuff?

19:33 Hannah Sim: Adding onto the name, I guess, now you can think about QPUs, right? And as I mentioned earlier, this kind of quantum circuit model, I think, right now, one thing people are thinking about is using a quantum circuit as some type of a, let's say, a quantum neural network. Where you're training these parameters on these quantum gates in order to, I guess, represent some type of model that can describe some data. But I guess there's a lot of work being done on quantum machine learning, but it's, again, still pretty early in its stages. So I think we're trying to really kind of figure out as a community what quantum machine learning means even. Does this mean that we're working with classical data or quantum data, or maybe both? There are lots of open questions.

20:24 Michael Kennedy: Well, I think part of the problem is we don't understand how normal learning, human, or animal learning works, all the way. And so our models are just like pokes in the dark. Like we are not like, well, this is how it works in people in brains, so here's how we're going to do it in computers. Well, we don't know that either, so let's try this.

20:40 Hannah Sim: Yeah, and add quantum to that equation and add to things that we don't fully understand and we don't know.

20:48 Michael Kennedy: I feel like computers are going that way in general, computers and software, even before we talk about quantum computers is that software's getting further to a place where it kind of defines itself and it builds itself up and it can do things that we don't necessarily, we can't ask it for justification, why it did that thing. It just we gave it some examples and now it does things that seem mostly right. And quantum computing seems like it's just going to take us farther down that realm of like, well, it works. Why? I don't know. But it works really well.

21:21 Hannah Sim: Yeah, no, definitely, definitely.

21:23 Michael Kennedy: So do you think what it means to be a programmer is going to be different in 30 years?

21:26 Hannah Sim: Right, even thinking about what a quantum software engineer means currently, I'm still trying to kind of figure that out. 'Cause I feel like that's the type of profession or career I want in the future. But do you have to do to prepare for this position?

21:41 Michael Kennedy: Right, how do you prepare for a position that's not fully defined yet?

21:45 Hannah Sim: Exactly, yeah.

21:46 Michael Kennedy: Let's say you're way in a better place than most people are right now. A quantum computing research lab at Harvard is definitely like one of the places I would think might help you on that path.

21:56 Hannah Sim: I hope so, I hope so.

21:58 Michael Kennedy: That's pretty cool. So I know what it means to build reliable software in the traditional sense of computing, 'cause it's, with the exception of parallel, a true parallel execution, which throws its own things in there, which by the way, I think it's interesting that the bugs created in parallel programs, traditional form, often get called Heisenbugs, which are borrowed from the whole quantum mechanics world, like you observe it, it changed the timing of the race condition and the race condition's gone, but you stop observing, it comes back, things like that. I know with the exception of the race conditions, what, for standard programming, what it looks like to build reliable software, unless the underlying hardware is broken. Basically, once you get it working, it stays working. What's the story with quantum programs? It sounds like if it's statistical based that it's mostly okay, or can we get to a place where it is fully deterministic in the same sense that we have now?

23:05 Hannah Sim: I think the power of quantum computing comes from the fact that it's not deterministic. I mean, this is a real challenge that we need to kind of find ways to efficiently sample from these distributions of possible states.

23:21 Michael Kennedy: So like in networks and stuff, we have like error checks and ways to sort of retry if something goes wrong. Could we have something like that in quantum computing where it's like, well, while we ran this we also ran like some sort of a checksum type thing and that failed, so we're just going to rerun that computation at this step?

23:39 Hannah Sim: I have to say, I'm not too familiar with this area, but I think there is some methods for, I think we call it, post-processing, where, like you mentioned before, if you get an outcome that you know is wrong, then you kind of ignore that run and then keep going through these, or propagating these quantum circuits until you get to an outcome you know is right, or is reliable.

24:03 Michael Kennedy: Yeah, just wonder if there's a way to like weave in like a known computation that it has to come out with the same answer. And then you also get the thing you're actually trying to compute. And if they're either going to be both broken or both okay, I don't know. Like I've not done any quantum programs . I don't really know. Just trying imagine how you build reliable stuff out of this.

24:21 Hannah Sim: Yeah, and that's still very much a challenge just because quantum bits or qubits themselves are still quite sensitive to noise. So it's hard to really check if the fault is coming from your program or from the noise on the qubits.

24:36 Michael Kennedy: Yeah, and all these things are pretty experimental. Like I haven't been to Best Buy for awhile, but I didn't see any quantum computers. Like I saw they have a little Apple section, they have a bunch of Windows machines. I haven't seen any Linux stuff over there. But you can go buy regular computers. But you can't go get quantum computers. And so would you say that quantum computers exist today or are they're just research projects that are like poking at this concept of it? Like how far down this quantum computer path are we?

25:03 Hannah Sim: So I would say that definitely, yes, quantum computers exist today. And there are different types of architectures that implement this. That being said, it's not like, like you said, you can walk into a store and buy a quantum computer. And because of this, what's really happening is that a lot of academic institutions and companies, they basically have these large refrigeration units that are cooled down to very, very low temperatures. And this is where the qubits reside. And because, like I said before, that qubits are very delicate and sensitive to noise, there are lots of scientists and engineers kind of trying to every day working to maintain these qubits. But in order to make these quantum computers work, and at the same time have them accessible to the public, so that they can try programming on these quantum computers. I think one way that they figured this out is to have it through the cloud where anyone around the world can just kind of submit these quantum program jobs.

26:01 Michael Kennedy: Right, yeah, people have said that cloud computing--

26:03 Hannah Sim: Quantum computers

26:06 Michael Kennedy: Yeah, people have said that the cloud computing is a little bit like jumping back to the whole fire up a terminal, dial in to some big mainframe type of experience. For a long time, computing sort of moved to the desktop. And now, in some sense, it's kind of moved back to the new modern mainframe. So you can take advantage of just all the scale of the data centers. And it seems like that's the perfectly reasonable solution, at least in the early days for these quantum computers. It's like they'll live in some special place underground away from other interference, like really, really cold, and then we can schedule jobs on them. Kind of like AWS Lambda, or something, right?

26:46 Hannah Sim: Yeah, I actually submitted some jobs on Rigetti Computings, 19 qubit chip last weekend. And it was very exciting, as a theorist.

26:56 Michael Kennedy: Yeah, that's super cool. All right, so you said quantum computers exist. And can you give us some examples? So there's Rigetti. I heard IBM has something. Early days I heard D-Wave. I think I saw like Nova show on D-Wave or something a long time ago. Maybe give us a rundown of some of these systems.

27:15 Hannah Sim: Like you said, Rigetti Computing has their qubit processor, IBM, Google, Microsoft, but also a lot of academic institutions 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, 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 Michael Kennedy: Right, there was this concept of quantum computing, but then to actually see this thing, which is pretty interesting. And it only had just like two bits, or something. It was really, really not a massive computing system. But it was working in the early days.

27:57 Hannah Sim: Right.

27:58 Michael Kennedy: That's pretty awesome. Then there's the IBM 50, right?

28:04 Hannah Sim: Mm-hm.

28:04 Michael Kennedy: So what's the story with that one?

28:06 Hannah Sim: So I believe they have a 50 qubits super conducting 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 in-house quantum programming packages that they come with so that any user can kind of play around with creating these quantum circuits and try running them on these qubit chips.

28:36 Michael Kennedy: That's a pretty interesting question. If you have this entirely different way of thinking about programming and modeling, like when I sit down and program in Python, like it's all about if this, if not that, while that, you know what I mean? Like it's all based on the and/or gates. And so the programming languages are going to be really different. But before I ask you about that, I want to actually ask you one other thing. So you said there's the Rigetti 19 qubit system, the IBM 50 qubit system. I have a 64-bit Intel Core 7, or whatever. How do I relate, like how can I relate the number 16 or 50 to what I know in terms of like regular CPUs? Is there a relationship? What is it?

29:22 Hannah Sim: 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 and if there's any like bit flips that I'm worrying about. There are these error correction codes and these redundancy checks that are in place. But for quantum computers, I think we're still at the stage where we can't ignore these effects. So when we say these 19 qubit chips, 50 qubit chips, these qubits are actually physical qubits that haven't been, so we don't have enough qubits in order to fully kind of implement these quantum error correction codes, such that when we run these quantum programs, we know with great probability that our program will run reliably, so to say. There will be a lot of noise that undergo. And the computation, or the result that we get at the end, we don't know if there has been some like various bit flips and other noises that happened. I guess right now it's a little too early for a direct comparison.

30:30 Michael Kennedy: Sure, but it sounds like maybe they're not as fully leveraged as say the systems that we have, something to that effect maybe. This portion of Talk Python to Me is brought to you by ActiveState. ActiveState gives you a faster way to build and secure open source runtimes, from your first line of code through to production. Every second you spend building your Python distro or trying to secure your Python programs is less time spent doing the work you love. 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. Standardize on your Python builds so you can have less friction in the development cycle and you can deliver apps faster. You can also get a unique server-side way to verify your Python applications at run time. Bake security right into your code without impacting performance. Go faster, spend more time doing the work you love and comply with your enterprise security needs. Try ActiveState and see why it was chosen by IBM, Microsoft, NSA, Seamans, PepsiCo and more. Join millions of developers who trust ActiveState to build their open source language distros. Visit talkpython.fm/activestate for a special offer. That's TalkPython.fm/activestate. We have this new programming model. How do we program it?

31:43 Hannah Sim: Like I mentioned before, I think this is a great time to really get into quantum programming or quantum computing, because you have actually several choices of packages that you can use to program on a quantum device. Some of them include IBM's Quantum Experience where they have some drag and drop interface in order to try to create your own quantum program.

32:05 Michael Kennedy: Wow, is it almost like Scratch, or something like that?

32:08 Hannah Sim: Yeah, you could think of it like that. I played around with it a little bit and it's quite fun. Besides that, they have their, I guess, non-drag and drop software package called QISKit.

32:19 Michael Kennedy: Okay.

32:19 Hannah Sim: I think Rigetti Computing has Forest, their platform is called Forest, but their programming language is Quil. I think Microsoft has Q#. And Google actually has a package called OpenFermion, which is a package that can be used to develop quantum algorithms, specifically for fermionic, or essentially, molecular systems. So that's, of course, one of my favorites.

32:43 Michael Kennedy: Yeah, of course. Those all sounds really interesting, but none of them sound very familiar. The only one that I've really looked through the programming model of was the Q# one from Microsoft, and that's 'cause it actually has interesting Python tie-ins. But most of these that you mentioned actually have some way to interact with them from Python, right?

33:05 Hannah Sim: Yes.

33:06 Michael Kennedy: Yeah, so tell us about that relationship.

33:08 Hannah Sim: I guess I've mostly played around with Rigetti Computing's pyQuil, where you essentially, right now, a Python program, you'd have these Python functions for these quantum gates. And what you're doing is kind of initiating a quantum circuit by inputting the number of qubits you want in a circuit. And then you can basically place different gates and different parts of the circuit in order to perform the computation you want, or alternatively produce a quantum state that you want. And they have these different backends, where one backend could be a simulator, where you can kind of look at how the wave function or the quantum state is evolving as you propagate it, your circuit. But then another backend is when you directly now communicate with the actual quantum computers maybe for Rigetti in Berkeley, or something, where after you write the quantum program in Python, you can just directly send it to the machine to run.

34:04 Michael Kennedy: That's pretty awesome. You mentioned the simulators, right? Like there's only a handful of these computers. What do they cost? Like if I wanted to, I don't even know if it's possible, but if I wanted to go buy say the D-Wave, I want to go and... I'm a real big enthusiast, that I want to put into my garage like the IBM 50. Like what would that cost?

34:25 Hannah Sim: Depends on what your job is, 'cause you're going to need a lot of money.

34:29 Michael Kennedy: Yeah.

34:30 Hannah Sim: Luckily, I think, in the US at least, there's this real initiative to kind of get quantum computing going and have it more accessible to the public. So I wouldn't be surprised if a lot of these national labs start investing in quantum computing, and even purchasing these machines.

34:48 Michael Kennedy: Sure. So long time ago, IBM had their mainframes and Bill Gates and crew came along and said, "No, we're going to have a computer on every desk." Things like to that effect. And there's some quote, I think it was from the IBM people, like "How many computers to there need to be in the world? Like nine, maybe 10?" I don't know. And it's probably like that way now for these quantum computers. There's like one or two of each of the ones that you've named, I don't know, not too many. But I feel like this time, because of all the infrastructure needed to say keep it cool, keep it away from interference with other sorts of radiations and interactions, like it might actually stay in the cloud only. Do you think that we'll ever have quantum computers like just in laptop form? Or is this something we're always going to connect to over services?

35:39 Hannah Sim: I mean, of course, having your own personal quantum computer is the dream, but like you said, there's still quite a way to go before we can really find ways to consider these noises and maybe avoid these necessities for cold conditions. But that being--

35:55 Michael Kennedy: Right, right now it's super cold. Like how cold does it have to be? Like you don't want to touch it cold, right?

36:01 Hannah Sim: Yeah, like millikelvin.

36:02 Michael Kennedy: Millikelvin?

36:03 Hannah Sim: Yes, close to absolute zero.

36:03 Michael Kennedy: Wow.

36:06 Hannah Sim: Yeah, but that being said, even with classical computing, when you mentioned this IBM quote, at that point, I'm sure there were a lot of skeptics and people who were like, "Oh, I don't know if that's going to be achievable." But, hey, like today we did achieve that. So maybe for quantum computers, new technologies will kind of come in and your research scientists will find ways in order to make quantum computing more accessible.

36:32 Michael Kennedy: Right, maybe some material science problem is solved that requires only liquid nitrogen level cold, not millikelvin cold.

36:41 Hannah Sim: Exactly.

36:43 Michael Kennedy: Interesting. Yeah, and we also have simulators, right? So not everybody has access to these machines, but I know that at least the Q# one, 'cause I looked through their documentation, they have like a literal simulator that you can go and write your programs from Python or Q#, or Jupyter, however you want to do on that thing, like you can go write your programs and simulate it. Is that pretty common these days?

37:07 Hannah Sim: Yeah, so I've been actually working with Rigetti's pyQuil simulator. And I think a lot of them work pretty similarly. And this type of tool or framework is really important for theorists. And just because we're kind of looking to develop algorithms for near-term computers, but at the same time, we want to do something useful. So, in some sense, we want to assume these error-corrected qubits.

37:32 Michael Kennedy: Yeah, so how accurate is this? Like it is a simulator and you're simulating things that we have a hard time fully contemplating. Like if I write some program and get it work on the simulator, how close is that to working, like how... What's the difference in say performance, things like that?

37:50 Hannah Sim: At this point, it will be great if the simulator that you're using has some way of creating noise or accounting for noise in your simulation. And assuming that you have a good enough noise model, I think that the result that you get should be pretty comparable to experimental results.

38:07 Michael Kennedy: Okay, that's encouraging. What about performance? It depends on what you're doing maybe, right?

38:13 Hannah Sim: Right, right. 'Cause right now, like I mentioned before, these experimental setups, there has to be a group of engineers and scientists that are trying to really optimize these operations in order to kind of perform a calculation using the actual quantum device. So when we talk about maybe runtime or some type of performance measure that it's hard to compare really directly right now. But, I guess, at least simulations take way shorter and takes less manpower, 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 Michael Kennedy: Yeah, I definitely think it's cool that these simulators exist, because there's not that much access to even these limited quantum computers we have. So definitely lets people do research and explore and test.

39:08 Hannah Sim: Mm-hm.

39:08 Michael Kennedy: Nice, okay, so let me ask you some sort of slightly higher philosophical questions about quantum computing. What are the things to really get excited about? Like what's going to be invented? What is going to be possible that is not possible now because of quantum computing? What do you see on the horizon?

39:26 Hannah Sim: We've already kind of discussed the possible applications of quantum computing, but I think just looking at the field itself, even now, I think, research or development, they're all moving very fast in quantum computing. But at the same time, I'd say this is a good time for people to get into quantum computing, because there's just so many open questions that you can ask. And quantum computing is one of those fields where people from various backgrounds, such as Math, Physics, Chemistry, Engineering and Computer Science, they can really all get involved and significantly contribute.

40:03 Michael Kennedy: Yeah, that's really cool. I feel like so much of what is sort of sold as a college degree of Computer Science is much more just Software Engineering and the actual science part of it is not so much there. But this seems like a place where Computer Science still is very much the experiment explorer, hypothesis and test stage, rather than we just go through like we're using unit testing and scrum and we're going to do that and here's how we refactor our database and what not.

40:34 Hannah Sim: Right.

40:35 Michael Kennedy: Yeah, it seems pretty cool. So what about energy? Like energy consumption by data centers is actually really huge. We never see them. There are these giant places in just a few spots on the globe. I think the closest data center to me is Prineville, Oregon, which is out by, and this literally, the reason it is there is it's by one of the dams in I believe Columbia River so that it has close access to lots of power. So the traditional CPUs take a ton of power to exist and do their work. How does that work in the quantum computing world? Like if we got a really well working quantum computer, would it use less energy, would it use more? What do you think?

41:20 Hannah Sim: I think as a theorist, I have much less of a intuition for these types of questions.

41:23 Michael Kennedy: Sure.

41:24 Hannah Sim: But given that I actually talked to one of my colleagues who is an experimentalist. And he mentioned that at least for certain types of qubit architecture, such as super conducting qubits, they do expect less power consumption per qubit.

41:39 Michael Kennedy: Okay, that's pretty encouraging.

41:40 Hannah Sim: Compared to the classical.

41:41 Michael Kennedy: Yeah, and I don't know the numbers, but I know that some problems are solved immensely faster by quantum computers. So maybe it even takes more energy, but it could solve it a thousand times faster. So in the long run maybe it's way, way more efficient. So there's interesting trade-offs from that angle, too, I would suspect.

42:00 Hannah Sim: That's true, 'cause I guess that's where you're like, in classical computing, you probably won't ever find it or get to the answer within the time of the universe. But for quantum computing maybe they will be possible.

42:13 Michael Kennedy: Right, right. But I feel like, you know, that's awesome, and that's probably going to happen. But at the same time, we'll just ask more complicated questions, and we'll ask them more often. It'll open up what we can do more with the various around. But it probably won't make any significant difference, I guess. It is pretty cool, though. So that's all pretty exciting. Like are there things that we should be concerned of? I mentioned cryptography, getting a cabin, checking out of society sort of thing. What should, I guess, we be careful of? Or just what would maybe be not a great consequence?

42:48 Hannah Sim: Regarding this loss of privacy, perhaps, that people fear, I think quantum computing will actually help with that fear in some sense, because of these proposals for different types of quantum key distribution protocols, or just in general how quantum computing will help cryptography.

43:07 Michael Kennedy: Even in some of the standard encryption conversation these days, I hear people talking about like quantum-safe algorithms that are sort of resistant to being cracked by quantum computing techniques that are different than, say, just depending upon exchanging primary numbers, primes. But do you have any experience with these? Do you know what that's about?

43:30 Hannah Sim: I've definitely heard of them. But I don't think I have enough expertise to say anything.

43:35 Michael Kennedy: Sure, I'm just trying to understand like what is that algorithm look like? How do you implement something like that that is just, I don't know, a problem that would be not so easily solved by quantum computing. I'm pretty interested in that.

43:46 Hannah Sim: But just going back to if we should.

43:48 Michael Kennedy: Should be worried, right? So it sounds like maybe there'll be this like rough patch while transition algorithms, but maybe in the long term quantum computing doesn't necessarily mean bad stuff for encryption and privacy.

44:00 Hannah Sim: Yeah, and I just want to say, as with all technologies, I think we always need to be wary of where and how this new technology will be used. But I think given that quantum computing's still very much early in its stages and we're trying to figure out to really fully leverage its strengths and capabilities to do practical tasks. So I think those will be relevant questions, but just not right now.

44:27 Michael Kennedy: Right, we're a little too early for that.

44:29 Hannah Sim: Yeah.

44:29 Michael Kennedy: Yeah, probably what will happen is we'll come up with these amazing quantum computers and people will just use them to like animate GIFs, like with their head stuck on a cat or something. Kind of like now.

44:42 Hannah Sim: Yeah.

44:43 Michael Kennedy: All right, so maybe we'll just leave it there for the quantum computers. That's really interesting. I have a slightly better understanding than I did before. Thank you for sharing all that. And course we'll put all the links to the various computers and APIs in the show notes. So let me ask you the two final questions I ask at the end of the show always. If you're going to write some code, maybe some Python code to talk to your Rigetti server, or something like that, what editor do you use?

45:09 Hannah Sim: So I go back and forth between Sublime and Vim, just because my dad was a software engineer and he exposed me to Vim.

45:17 Michael Kennedy: That's Vim from an early age, awesome. All right, how 'about a notable PyPI package? Like many of these amazing things you've been talking about, you can literally pip install them, right?

45:26 Hannah Sim: Yes, yes. So I've already mentioned these two before, but of course being a chemist, I really enjoy using OpenFermion for basically implementing quantum chemistry algorithms for quantum computers, as well as pyQuil, which I've mentioned earlier by Rigetti Computing. Not only is it really well tested and documented but it has a really great Slack community, where you can just post questions about the syntax as well as general questions about quantum computing.

45:54 Michael Kennedy: Oh, very cool. It's really nice to have these Slack communities or Gitter channels, or whatever popping up that you can actually get in touch really easily with people doing similar things in all specialties.

46:04 Hannah Sim: Definitely.

46:05 Michael Kennedy: Yeah, cool. All right, so it's not too early for people to get started with quantum computing. You say you think it's a good time to get started, build some experience and play with some simulators. Something like that?

46:17 Hannah Sim: Yes, definitely, I encourage it highly.

46:19 Michael Kennedy: All right, awesome. Well, Hannah, thank you so much for being on Talk Python.

46:23 Hannah Sim: Thank you, Michael.

46:24 Michael Kennedy: Uh-huh, bye. This has been another episode of Talk Python to Me. Today's guest was Hannah Sim. And this episode has been brought to you by Linode and ActiveState. Linode is bulletproof hosting for whatever you're building with Python. Get four months free at talkpython.fm/linode. That's L-I-N-O-D-E. ActiveState gives you a faster way to build and secure open source run times, from your first line of code through to production. Check it out at talkpython.fm/activestate. Want to level up your Python? If you're just getting started, try my Python Jumpstart by Building 10 Apps, or our brand new 100 Days of Code in Python. And if you're interested in more than one course, be sure the check out the Everything Bundle. It's like a subscription that never expires. Be sure to subscribe to the show. Open your favorite podcatcher and search for Python. We should be right at the top. You can also find iTunes feed at /iTunes, Google Play feed at /play and direct RSS feed at /rss on talkpython.fm. This is your host, Michael Kennedy. Thanks so much for listening. I really appreciate it. Now get out there and write some Python code.

Back to show page