Zurich Zurich

Superposition Guy’s Podcast — Mariia Mykhailova, Microsoft Researcher and Book Author

Quantum Source Quantum Source

“The Superposition Guy’s Podcast”, hosted by Yuval Boger, Chief Commercial Officer at QuEra Computing

Mariia Mykhailova, Principal Quantum Software Engineer at Microsoft Quantum, and author of “Quantum Programming in Depth”, is interviewed by Yuval Boger. Mariia describes the book which addresses the practical skills needed to implement real quantum algorithms. She emphasizes the importance of having a solid foundation in quantum programming and highlights her approach to teaching, which focuses on bridging the gap from basic concepts to advanced quantum programming techniques. She also shares insights into the current state of quantum programming tools, the challenges of teaching quantum computing, the potential future applications of quantum computers, and much more.

Listen on Spotify — here

Responsive Image

Full Transcript

Yuval: Hello, Mariia, and thank you for joining me today.

Mariia: Hi. Thank you for inviting me.

Yuval: Of course. So, who are you and what do you do?

Mariia: My name is Mariia Mykhailova. I’m a principal quantum software engineer at Microsoft Quantum. I work on a lot of things, including quantum education and algorithms for fault-tolerant quantum computers. In my extensive spare time, I teach quantum computing at Northeastern University and write books – about quantum computing, obviously.

Yuval: There are several books on quantum computing and I think also on quantum computing programming. So congratulations on your new book. What’s unique about it? Why is it different or better or aimed at a different audience than the existing books?

Mariia: So my new book, “Quantum Programming in Depth,” tries to address a gap that I see very often when people start to learn quantum computing. There are lots and lots of materials that are 101-level, introductory kinds of materials. What is a qubit, how we describe a quantum state, how we do measurements on it. But then, once you have covered those basics, there is a gap to how do you get to actual real quantum algorithms. How do you get to a point at which you can read a paper and implement an algorithm in it? And it is a pretty big gap, and there are very few materials I know of that address it. So this is what I’m trying to do with my book. I’m trying to take the learners to the next step. What happens once you know the basics?

Yuval: So I’ve started reading your book and going through the exercises. They’re very lovely, thank you. And so if I didn’t know how to program quantum computers before and I finish all the exercises in the book, what would I be able to do?

Mariia: So my hope, also of course I still have to test it because I haven’t actually finished the book. So my hope is that somebody who learns it all and does all the projects themselves is going to have a pretty solid foundation in quantum programming. So they will be able to see a problem and either figure out an algorithm for solving it or look it up somewhere, and then they’ll be able to convert it into a quantum program. So they will be able to implement it and then test it because that’s a really important step in quantum software development. Same as in classical, actually, exactly the same. You can write the code, but you also need to make sure that it is correct. So many times when I was even writing even this book, I would start by writing tests for the project. And then when I write the actual project code, I find that I have a bug. It’s either a typo or some issue because I forget how the endianness works in this particular case. And then because I have tests, I can find the issue immediately and fix it. It would be very hard to do without tests. And then of course once you have tested your algorithms, the next step is figuring out its performance. It’s going to be the last chapter of the book, it’s not written yet. But it is another discussion that a lot of sources just don’t mention. If you have a quantum algorithm, is it good? How do you define “good”? How do you define “better than classical”? A lot of sources talk about it just theoretically, asymptotic kind of complexity, like Grover’s search, it offers quadratic speedup. Does it mean that this algorithm is going to be practical once we have quantum computers and run it on them? Once we do more complicated analysis, taking into account a lot of factors that go into it, it turns out that it probably is not going to be practical. But you need to know how to do this.

Yuval: You mentioned that the book is not finished yet. I think part of it is already available on manning.com. How does that work?  Is it chapter by chapter? Does it get updated over time? How does this book work or how can one access it?

Mariia: Yes, Manning has this program called “Manning Early Access Program” (MEAP) in which when the author works on a book, it can be a pretty lengthy project. I have been writing the book for over a year actually by now and there is still some work to be done. But if we are writing about technologies that are cutting edge, like quantum computing, we want the people who want to learn it to be able to do it as soon as possible. So the Early Access Program does just that. It releases the chapters that are already written and reviewed way before the book completely is going to be finished and edited and polished and published. So you can start learning probably half a year before the book is finished, maybe even more than that. So right now there are already several chapters out and you can get the book right now and start reading them and then as we finish the first edits on the chapters, we publish them again.

Yuval: What does one need to know for the book to be effective? I think you need to know a little bit of linear algebra, maybe you need to understand Dirac notation. What does one need to know? And I guess more specifically, should I be a physics grad? Can I be a high school student? Can I be a computer science graduate? What are the prerequisites to enjoying the book?

Mariia: I hope that it is going to be enjoyable and useful – let’s not forget useful – to broad audiences. You do need to be comfortable with some concepts to get started on it. You don’t have to know any physics. That’s definitely at no point in the book I’m relying on understanding how photons work or electrons or anything physical. So I’m approaching quantum computing strictly from a mathematical and software engineering point of view. You do, however, need to be familiar with the basic concepts. So you need to understand what are qubit states, how we represent them, how quantum gates work on states and how measurements work on them. Those are pretty much all the main prerequisites. Because anything I need afterwards, for example, when I talk about phase estimation, I’m going to introduce what are the eigenphases and eigenvalues. So you don’t need to know that part upfront. But the basics you want to be familiar with, because I’m not going to spend a lot of time reminding you how measurements work. I will spend a bit of time on this, but if this is completely new to you, you might not have a very easy time following this. So it’s a refresher, not an introduction from scratch.

Yuval: As you think about a classical software stack, people used to program in, I guess some still do today, in assembly language and you could program in C or you could use higher level languages or maybe at the end you use Mathematica or something that’s even more abstract. Where is quantum programming on that range from assembly language all the way to shrink-wrapped applications in your view?

Mariia: It is still pretty low on that stack, because most of the programs we write, we still write them in terms of individual gates. So it is not as bad as it could have been. We’re not writing programs in terms of “send this particular pulse to this particular ion”, which is very lucky. It’s not the kind of programming I would like to do. But we’re still not at the point at which we just compose an arbitrary algorithm out of building blocks. That of course depends on the language. There are some quantum software stacks that are higher level than the others. But generally I would say there is a lot of work to be done there still. Same as in other areas of quantum computing.

Yuval: One of the areas that people work in quantum computing is making larger computers in terms of the number of qubits. How do the skills that one learns in the book translate to larger and larger machines? Can I use these skills to write an algorithm for 256 qubits? Or would that require higher levels of abstraction?

Mariia: Oh, you absolutely can. Some of the projects that I’m considering are kind of universal. If you want to prepare a state, you follow the same logic, regardless of how many qubits are involved. Now, of course, if you want to prepare a state that includes all 256 qubits, you’re going to probably run into some other issues. For example, how deep is your circuit and how long it’s going to take you to prepare this state. Do you possibly want to break this state into some sort of different representation? Do you want to maybe approximate it so that you end up in a slightly different state, but the one that you can prepare faster? But those are different kinds of considerations. Generally the approaches you take in the book in going from an algorithm to implementation and to figuring out whether it’s correct and how performant it is, those are going to be universal. The chapter in which I talk about performance of quantum algorithms, that one is actually going to take the project from the previous chapter. In the previous chapter we’re going to solve a problem for a very small instance that is going to run on a simulator. And then when we talk about performance, we say, “Let’s take the same problem to a much, much bigger scale, the kind of scale that we’re not going to have computers to approach by the time the book is going to be published. And let’s compare those implementations that we did for the algorithm, which one of them is more performant.” So you already can do these kinds of things with the software we have right now and the tools we have right now, resource estimation. You can evaluate performance of algorithms and compare it way before you can run it on real quantum computers.

Yuval: How about hybrid algorithms? Some work in quantum computing is done with hybrid classical quantum, whether it’s variational algorithms or even other things where just part of the processing is done on quantum and other in classical. Is that also covered in the book?

Mariia: A little bit. When I talk about phase estimation, I cover multiple algorithms. Quantum phase estimation that is kind of pure quantum, but also iterative and adaptive phase estimation. And adaptive especially is a good illustration of how this hybrid process works, combining classical with quantum in a kind of tightly coupled, interleaved way.

Yuval: You mentioned that you teach quantum computing, I think you said Northeastern University, and you’ve been writing the book for a year. What do you know about quantum programming today that you didn’t know or didn’t realize a year ago?

Mariia: How specifically quantum programming or more generally quantum computing? Because I find that I learned something new for every single chapter of my book. There are just slightly different things for each chapter. For example, for state preparation and implementing arbitrary unitaries. I had to think more about the algorithms themselves. The algorithms for implementing an arbitrary unitary, I learned from scratch. I didn’t know it before I started to write the book. For some of the later chapters, it was sometimes kind of returning back to basics. So, I’m very comfortable with reversible computing. But once I start teaching it to somebody who is not comfortable with it, I know how it’s supposed to work, but how do I bring them there? How do I convince them that this is the right way to do reversible computing and other simpler ways are not going to work? So that kind of taking a step back and reconsidering is a very useful exercise to do.

Yuval: In your background, by the way, in terms of training, are you a computer scientist or a physicist or an English major or something else?

Mariia: Definitely not an English major! My editors are responsible probably for 30% of the “the” articles in my book. I am by training an applied mathematician, which is what you call software engineer, effectively, back in Ukraine. So my training included a lot of math, a surprising amount of physics, and actually not a great deal of software engineering. Less than you would expect it to have.

Yuval: When you teach quantum programming, what do you find that students have the hardest time comprehending? You mentioned reversible computing, but are there other concepts that you’re still struggling with how to get across?

Mariia: There are some things that can be kind of hard to follow. For example, applying gates to states as matrices is kind of doable when we’re talking about small systems like one, two qubits. But when you go to larger systems, you want to ultimately switch to Dirac notation and you want to do this thing in which you apply the gate to each basis state separately, and the results are a linear combination. And this step I found was surprisingly tricky. This way is how you can easily apply a gate to qubits that are not adjacent, or it actually fits into reversible computing, similarly, because when you define reversible computing, you define it on basis states, and then again linearity plays a big role. This one I found caused a lot of questions. So that’s one of the topics I wanted to give a lot of attention to in my book, to hopefully make it more palatable.

Yuval: When I studied linear algebra many years ago, I think that once the class went from one, two, or three dimensions to 17 dimensions or n dimensions, then at some point you can’t really visualize it with your hands and people just say, “Just trust the math, you understand the process, just follow the math and it will lead you there.” How quickly do you get to that point in quantum computing?

Mariia: Right away. I will admit that even for a single qubit, the Bloch sphere, that is pretty much ubiquitous in materials for one qubit, it just doesn’t do it for me. You have orthogonal states that are on the same axis. This is when the Bloch sphere just loses me completely. So when I teach, I don’t even try to start with it. I just say, “Trust the math.”

Yuval: I think you start the book by explaining quantum advantage or supremacy, sort of that point in which quantum computers surpass classical computers for useful programs. Given your understanding of quantum programming and quantum computing, when do you think that point will come? In what area do you think it will come first?

Mariia: You know what they say, prediction is hard, especially about the future. So we expect, and by “we” I don’t mean just me and my editors, I mean the broader scientific community, and probably with a bias towards Microsoft point of view, that the first applications of quantum computing are going to be in chemistry and material science. We did some interesting work on resource estimation of algorithms to show, for example, that Grover’s search is not really practical and those kinds of things. Chemistry and material science look like the most promising kinds of things right now. As for when exactly this will happen, we’ll just have to wait and see.

Yuval: From a programming standpoint, once error correction and logical qubits become more mainstream, does anything change in the way you would program a quantum computer?

Mariia: I hope not. So the languages we work with right now, the languages I use in the book, Q# and Qiskit, they are agnostic to the platform on which they run in the way that they don’t care what kind of qubits they run on. They just have commands like “I need that many qubits for this circuit” or “I need to allocate that many qubits to use for this operation.” And the translation between those qubits, the logical ones, and whatever happens underneath is done out of sight for the software developer. So something is happening there. Right now, if you run, for example, Q# code on one of the simulators or hardware backends in Azure Quantum, you don’t actually need to change your code from running on a simulator to running on trapped ions. This is all done by lower layers of software. So when our qubits become properly logical and each qubit is going to be actually represented by a bunch of physical qubits, that will also be taken care of by those lower layers of the software stack. So you take the same program and you just run it wherever.

Yuval: I think some people would challenge that and say that conceptually you’re correct, but because quantum computers are so different from each other in terms of connectivity and native gates and what have you, then you should be thinking about full stack optimization and not just assume that some lower layer will take the code. I mean, a lower layer can take the code and make it run on the computer, but to make it run really well, perhaps there needs to be closer to full stack optimization. How would you respond to that?

Mariia: I don’t think we can do something like a full stack optimization done by the end application developer once we get to proper sizes of algorithms. And proper sizes, I don’t mean a thousand qubits, I mean a million physical qubits, because the resource estimates we do for some of the algorithms that we want to run that make some realistic assumptions about error correction we might use in the future and the connectivity that we might use in the future, they call for millions of physical qubits. I don’t want to be writing an application and thinking about the chemistry that happens there, the logic that happens there, at the same time at which I think about the connectivity between those million qubits. That’s just… I don’t think it’s doable. So we do need to invest in clever software in the lower layers so that the end application developer doesn’t need to think about it.

Yuval: There’s a lot of talk about quantum and AI, and sometimes it’s about how quantum machine learning is going to help AI run differently. But how do you think about AI helping write quantum programs? What are you seeing in the market there and how do you see that progressing?

Mariia: It’s an interesting question. I just finished preparing some demos for the tutorial we’re giving with the team at IEEE Quantum Week in a couple of weeks on this exact question. Right now I would say… On one hand we do have a copilot in Azure Quantum that is trained specifically to write Q# code and to help the user look up different pieces of syntax and different samples in Q#. But on the other hand, it is based on the general copilot. It’s a large language model. It’s not very good at math. So if you just ask it to write me a code that prepares this state, it’s not going to understand you. It will write you some code that prepares some state, but chances are that it’s going to be a different one, because it doesn’t do the math under the hood. Right now it is most useful for looking up some concepts and documentation, things that you think about in terms of language. If you ask it a theoretical question about what is superposition, that kind of thing, it is going to give you a reasonable answer. But questions that involve math still require some work to be done for those kinds of AI tools to be really useful for writing quantum code.

Yuval: And last, I wanted to ask you a hypothetical question. If you could have dinner with one of the quantum or computer science greats, dead or alive, who would that person be?

Mariia: Oh, that is complicated. Can I say Einstein? I think he was a great conversationalist.

Yuval: You can say whatever you want. So, Einstein because of obviously great physicists, but a great conversationalist?

Mariia: Yes. I mean, if we are doing dinner, not whiteboard talk. I’m not going to ask him hard questions about physics or formulas. So we’re going to have some more general worldview discussions.

Yuval: Wonderful. Mariia, thank you so much for joining me today.

Mariia: Thank you for having me!

To subscribe to the audio podcast, please Spotify here

 

Yuval Boger

Share this article:

Keep track of everything going on in the Quantum Technology Market.

In one place.

Related Articles

Join Our Newsletter