1. Home
  2. Explore
  3. Computer Science
  4. Atos Quantum Learning Machine

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Atos Quantum Learning Machine

Transcript

- [Yuri] Hi, everybody. This is Argonne, our quantum tutorial. And, today, we're going to continue our talks, presentations about tools, software tools for to use. On Monday, we talked, we presented Qiskit. Today is going to be a talk by Thomas Ayral from a company called Atos. He's going to give you a talk about QLM platform.

And later, in one hour, it will be 11:00 central time, he's going to give a talk about Qtensor, a simulator developed here at Argonne. Thomas is our collaborator. We have, for example, joint projects, (indistinct). Thomas, it's all yours. - [Thomas] Yeah, thank you, Yuri. Thank you for the introduction and thank you all for attending this session, where we're going to learn together how to run noisy quantum computations on a framework called the Atos Quantum Learning Machine. And, today, you're going to play with the free version of the quantum learning machine, which is called myQLM. So, I'm Thomas, from the Atos Quantum Lab, which is located in the Paris area, in France. And, today, I'm going to tell you first,

for the first few minutes, a few words about what this quantum framework is all about. And, then, we'll do it together, we'll build together our own small variational quantum algorithm in the presence of laws. So, the quantum learning machine is a simulator, is a classical simulator for quantum computers, which has different features, including quantum programming libraries, where you can write quantum circuits, for instance. It also has quantum optimization,

toolboxes that allow you to take into account hardware constraints that come from the hardware that you have access to. And this comes from the fact that Atos is primarily HPC, a High-Performance Computer builder, that traditionally buys computer's processors from processor makers, and then assembles them into large super computing centers. So, our core job is basically to integrate classical processors, usually, and, now, quantum processors, into larger systems.

So, we have all these circuit optimization libraries, that are provided within QLM. And, then, once you have optimized your circuits, you can try to simulate it on a classical computer, and this is this big machine here, which is called the QLM. It's a big machine with a lot of RAM, where you can do very powerful, perfect circuit simulations, as well as noisy simulations. Today, we will not choose QLM, which is a remote server, which is, for instance, accessible at Argonne, but we will use the myQLM, which is the laptop version of QLM, where you can nevertheless run toy circuits, and play with variational quantum algorithms, as we will see today. And what's important is that this framework is fully interoperable with IBM Qiskit, with Google Cirq, and other frameworks, in the sense that you can write programs with QLM, and, then, run it, run them on IBM Qiskit, for instance. And I will show you an example. And, conversely, you can also write programs in IBM Qiskit,

and, then, run them or optimize them, with our optimizer or simulators. And so, here, what I was saying is that what we're going to do in this very small example, and we play some more with it later, is we have a Heisenberg Hamiltonian which is a Hamiltonian which has an entangled runset. And, therefore, it has a non-trivial runset. And, here, what we do is that we first created this Hamiltonian because we want to find this constant energy later. And, then, here, what we we're doing here, is describe with a quantum program variational circuits, which is depicted here on the right, with a Hadamard gate, then, a RY gate, with some parameter, theta zero, then, a Z90 gate, then, some X and Y quotations, with some angles. This is exactly what is described in this code snippet, here. And, then, all we need to do is perform a minimization task using an available QP user, an available simulator, in that case, of quantum processor. But this would also be an actual QPU,

as I will show in the next slides. And, here, this is exactly what I do here. I take what we call here linear algebra quantum simulator, which basically performs a simulated perfect simulation of your quantum circuits. And, here, you see that in front of this QPU, I added a small, what we call, plug in, which is going to make this QPU, able to handle variational jobs. So, it's going to understand that if you, if it is fed a circuit with some angles and a Hamiltonian, it's going to try to optimize the angles in order to minimize the energy of the Hamiltonian. And, so, here, when I submit this job, which contains the circuit, the variational circuit, and the Hamiltonian, to this QPU, it's going to be the optimization task that is being performed in the queue in. You can see here that when it starts from a random guess for the angles, it starts from really high energy of three, and, then, the classical minimalization ends up at something like minus three,

which turns out to be the runset of this Hamiltonian. And this is something that you can really achieve in this couple of lines. And the documentation of this framework is available here: myqlm.github.io. And I will show you, later, how to set it up. And now, now comes noisy simulation. In the previous slide, what I mentioned is that we used a QPU, which was a perfect language, whereas we'd perfect Hadamard gate, perfect CNOT gates However, today we are in the so called NISQ era, the Noisy Intermediate-Scale Quantum era, where quantum processors are noisy in the sense that they do not have perfect operations. They don't have perfect initialization. They do not have perfect gates. They do not have perfect readout. In order to model these errors,

one writes so-called noise models. And, then, one needs to simulate those noise models. And this is what it's possible to do on QLM. And, today, I will also show you a very small plugin that is available on myQLM to perform a very simple noisy simulation, knowing that the actual noisy simulation capabilities of QLM are in the true QLM, and not in myQLM. So, here, today, to be more precise, we're going to play with a depolarizing noise model for QLM. And we're going to try to understand how this noise source affects the convergence of the various neural qubit migrant source.

And just as an aside, myQLM is not disconnected from QLM, so my QLM, which is the software you're going to use on your laptop, can also access a bigger QLM server, which has noisy simulation capabilities, a hundred percent, which means that what is possible to do, if you have access to a QLM like Argonne's QLM, it's possible to write the program on your laptop, and, then, basically, perform a true noisy simulation on the QLM, or use one of the powerful classical simulators of QLM

on this QLM server. And this new part of QLM is called QLM as a Service. And, now, to wrap it up, I just saw an interesting feature, that I already hinted at, is that, once you've written your variational quantum program for the QLM, you can also replace the QPU, which was, previously, a QPU as a classical simulator, whether perfect or noisy, you can replace this QPU with a Qiskit packet. And this is what I do here in this slide. I just import what we call a backend to QPU class,

to which you can give your IBM a quantum experience token, which, in principal, you already have, because you have created such an account. And you can specify which backend you want to run your quantum computation on. And, then, you just send the exact same job on this new QPU, and you get some results, and, then, you can compare it to your perfect results, for instance. And this can be, also, installed free. So, now, this is it for the small introduction to QLM. And, now, we can start the tutorial per se. So, there are two main ways to save by the internet. - [Yuri] Who's talking? Yes, sorry to interrupt. Can you actually stop, like, maybe, every 10 minutes, or so, to ask if there are questions? - [Thomas] Yeah, sure, sure. Actually, this is the part where the plan is to ask for any questions. So, here, we're going to switch to the hands-on part. So, if you have any questions at this point, this is the right time to ask.

And, in general, if you you want to interrupt, just feel free to interrupt. - [Yuri] All right, yes, great. So, while we are answering, Thomas is answering questions, you can look at right, and launch mybinder, there's instructions on the screen. Do you see you questions, by any chance, it is one of, here are two questions in the chat. - [Thomas] I don't see questions, at the moment. No. How can I, so, I mean, I can start to expand. - [Yuri] No, it's okay. Yes, you can just stop on there, and you can see it. That's one way. - [Thomas] Okay. So, does this mean like I was using, so, Eesh is asking, "Does it simulate noise using quantum channel framework as used by Qiskit or through the internet master equation framework?" The answer is both, meaning that if you have a more discrete description of your quantum program, then, if you use a circuit,

at the moment, we're using quantum channel frameworks, but we also have some analog simulation features where you can describe your quantum program as a schedule, an analog schedule, in which case, one of the ways to specify noise models is to read that operators, although we also have other ways to specify noise. And, then, to your question, "How is Atos better than Qiskit simulators." So, I would say it's different Better or not, that's up for you to judge. But, so, one of our particularities is that our simulators are pretty fast, because the way they run on the QLM, the QLM is a very special machine that has a lot of RAM, and it's not distributed memory. And, therefore, there is no overhead from communication that usually happens on parallel machines, on distributed machines.

And, therefore, we have very fast stimulators, that can, that really allow you to test the program a noisy quantum program with VQE, which requires a lot of hosts for the noisy simulator, very fast. That's one thing on the, let's say, on the physics part, where you can, basically, code up any noise model you want and, then, perform efficient noisy simulations. And, then, on the compilation side, our particularity, as a hardware maker, or not as a hardware maker precisely, not so, as a middle man between hardware makers and users, is that we really have a strong focus on the compilation part of quantum programs. Maybe, if you write your textbook quantum program, your Shor algorithm, or your Grover algorithm, as in the textbook, and, then, want to compile it, for, say, tracked ions or superconducting processors,

or, say, Rydberg atoms, then, our specialty is really to do this transition between a hardware agnostic user to a hardware specific constraints, like connectivity constraints, and so on and so forth. So, this is where, really, our value is. - [Yuri] Yes, so, maybe, I'll act as a user of QLM. Where at, QLM has, from my experience, more sophisticated noise models, and there are, obviously, other advantages, but this one is, I guess, is most notable one, a most useful one for me personally.

And, now, I think, maybe, it's worth mentioning, is that Qiskit and QLM, they are compatible, right? You can actually use, you can use QLM to generate, I'm not sure, actually, how it works, exactly. You can generate circuits, right, which are actually compatible with Qiskit, is that right? - [Thomas] Exactly. So, any circuit you write in the QLM language, you can run on a Qiskit backend, and, conversely, any IBM Qiskit circuit that you buy, it can be run on QLM simulators, or optimized with QLM compilers, for instance.

- [Yuri] Okay, there's some question. - [Thomas] Then, there's also a question from Alex, which is, "What is the source of noise for your simulation?" So, basically, on this, on the noise models that we provide, are basically any nose model, in the sense that any props operator that you choose, or that you measure using tomography, can be used. So, you are really free to use any noise model you want. So, that means that any source of noise is possible. So that's for quantum operations, so we need gates, but if you want to model so without error, you're also perfectly free to specify yourself any two outcome PLTM, and that will describe your readout cause. And the same goes for initialization.

And, then, Arnice, you're asking, "What are the differences of your hardware platform for quantum simulations with Ms Azure Platform?" So, maybe, can you be more specific? So we, so our platform, we don't have a hardware platform, in the sense that we don't have quantum hardware platform. The QLM is a purely classical machine that is supposed to emulate quantum computers. So, I'm not sure I understand exactly your question, but, maybe, she can be slightly more precise, I can try to.

All right. Any further questions so far? Yeah. Okay. So, it also means that classical computer, so, then, one would have to check, what are the capabilities of Ms Azure, in terms of the different simulators they provide, perfect or noisy. One particularity of QLM is that it provides not only, let's say, usual perfect simulators, which are linear algebra beds, but we also provide a stabilizer, or Clifford-based simulators, which is pretty widespread, now, but also Matrix Products X simulators, which can allow you to simulate circuits, which do not have a too high level of entanglement. So that's on the perfect side.

And then on the noisy side, as I said, we have a very particular hardware, classical hardware that allows to really be very fast in how we do our noisy simulations, whether in a deterministic way, or in a stochastic way, which is something you can also choose as a user. But let me emphasize that, today, what we're going to play with is a very simplistic noisy simulator that is available freely on myQLM. So, that doesn't really compare to what is on the actual QLM.

All right. So, now, maybe, it's a right time to ask whether you've succeeded in clicking on the mybinder link, and setting up the mybinder session. In principle, once you click on the mybinder link, you should see that something is setting up. It should last for a couple of seconds, or up to a minute or something, and, then, you will see a list of sites. - [Yuri] So, Thomas, maybe, you can show this on the screen. - [Thomas] Thank you. So let's let me do that.

And, then, be aware that when I do that, I can't see the messages, anymore. So, Yuri, can you, then, tell me if there's a message? - [Yuri] Yes, I will. - [Thomas] All right. So, let me, now, switch to. So, now, if you go to the git hub page of the workshop, you'll see a page, myQLM hands on, under Thursday simulators slash my QLM, And, then, you'll see here, there's a small logo. - [Yuri] No, Thomas, we cannot see. It's a gray screen.

We see, 'cause, sort of, but we don't see what page it's on. - [Thomas] What do you see, now? - [Yuri] It's just gray screen. - [Thomas] Okay. So let me, then, stop, stop sharing, and share again. That should do the trick. There you go. So, now, it should be better. - [Yuri] Yes. Now it's working. - [Thomas] Okay. So, now, what you should see, once you go onto the Argonne quantum computing tutorial, 2021, git hub, you should see, there's a folder called Thursday Simulators, and, then, there's a subfolder called myQLM. And, here, then, you should see a logo, launch binder. What you should, then, do is click on it.

And once you click on it, what you should see is something like this, where you have a binder logo, and it's setting up the installation. And it should last for a couple of seconds. So, you see that it, on my side, it's already done. And, once it's done, you'll see a list of files. You see a couple of myQLM files, and what you want to do, now, is click on the IPython notebooks. So, that's the file called VQE underscore myQLM IPython notebook. So, that's, let me do that, right now.

So, that's what I do now. Let's go. So, now, I just clicked on it. And, here, you should now see a notebook, a Jupyter notebook. And I assume you're pretty much familiar with how Jupiter notebooks work. If not, just shoot a question, and we'll try to figure out what you need to understand.

And, here, what I started with is a very simple example. So, you don't need to do anything. Everything is already installed. And with these circuits, we now wants to check that upper probabilities of running such a circuit on a perfect QPU, are indeed the ones that correspond to zero zero plus one one, over square root of two. For this, what I do is that I load a QPU, the default QPU from my QLM, by invoking this qat.qpu's package. Then, I have this function, get this default QPU, that I called, in order to construct this QPU, i.e., this perfect simulator.

And in order, now, to use this QPU, to use this QPU to produce the outcome probabilities, what I'm going to do is create what we call a job. And the job can be something, is something, where we usually put a circuit, and, then, an observable to measure at the end of the circuit. And if we don't specify an observable, that just means we want to get the probabilities corresponding to the final state on this circuit. So that, here, in this very simple example, what I do is create a job for my circuit.

So, that's a very simple job with no observable. And I treat the job to the submit method of the QPU. So, I basically take my QPU, and I submit it a job, and it returns the results. And, here, because I didn't specify any observable, the result is going to contain the bitstrings corresponding to running the circuits and measuring the bitstrings at the end. And, so, what you could do, now, is maybe start running this cell, here, by doing control enter, match enter, or control enter, and you see here that what you see from running the first set, which is here, this for loop, where I do it, a for loop, over the above; I'm printing, basically, that the two non-zero amplitude states are zero, zero, and one, one, with an amplitude of one over the square root of two, both times.

And, here, I had it right. I was entitled to calling for the amplitude, because I'm working with a perfect state simulator, but if I were working with a noisy simulator, I would not have access to amplitude, in which case, I could only ask for sample of probability, which I do here. And if I run it again, I do get point five and point five. So, now, what I was explaining was we want to create a job for your QPU, which is slightly more complicated than just a circuit,

because what you want to do is execute a circuit, and, then, measure some observable at the end. And this is what we're going to do now, by specifying, by learning how to specify, a Hamiltonian, which are described by the sum of some coefficient, times the product of how many matrices. And, here, this is, this is angle. So here, the example I took was one half times Sigma X, one qubit zero, plus Sigma one, qubit one, plus one fourth of Sigma Zed on qubit one. The way to write such an object on, either QLM, is by instantiating an observable object acting on two qubits with two terms. So, the way that gets defined by your list, which has had as many terms as it has, as there is in the observable. And, so, here I have two terms, one with one half, then, the Pauli string corresponding to the two-party matrices, Sigma X and Sigma Y, and the qubits on which is adds. Hence, once I have this observable, I can now create a job

that contains both the circuit and the observable and submit it to the QPU. And, as you expect now, as you're expecting, if you submit such a job, with a circuit and an observable to the QPU, the outputs result is going to contain the value, the average value of the observable. And this is what I created, here, when I write "print O equals results dot value." So, we have a question from Alvin, who is asking, "Does the X go on the first, and the Y, on the second?" So, the way that you specified who goes where is by specifying the second argument of terms.

So, let us look at it together. So, here, for instance, if I say X Y, that doesn't tell me where Sigma X, and Sigma Y are. Asking it is telling me in which order they are acting. And, here, when I say zero, and, then, one, in the list that follows, that's where I say, where X is acting, and Y is acting. So, had I written, "one, here, and zero," that would have reversed, that wouldn't mean the same thing. That would mean the X acts on one and Y acts on zero, Does that answer your question, Alvin?

Okay. I assume so. So, now, what we're going to do is that we're going to just code up together the Heisenberg Hamiltonian, which is written here, with, "J equal one". And, so, here, all we have to do is execute Hamiltonian, and you see here that I have already created a observable term, with two qubits, and all we have to do it fill out what are the power terms for this Heisenberg Hamiltonian. And, so, maybe, let's do that together, and you can try yours on your own.

So, here we have three terms. So, we're going to have basically three things, three terms in this sum. And each term has, in position, one, because we're going to set J to one. And, then, we need to specify the first time as only Sigma X, Sigma X. I'm going to write X, X. And X and X acts on qubit zero and qubit one. I got in the latex formula, I got one and two, but we can start from index zero, since we were doing Python. So, here, I have X X, then, here, I have a Y Y term, acting on qubit zero and qubit one,

And we have last term coefficients, also one, as I put the same positions in front of all the terms, with qubit k, around data, by changing the co-efficient. And the Zed and the Zed act on zero and one, respectively. And I can execute this and print it. And you see here, I get, I get a printout of what is this Hamiltonian. And if we want to know, in advance, what answer we are expecting, what we can do is cheat a little bit, by constructing the two to the power n,

two to the power n matrix corresponding to this Hamiltonian, which is a bit stupid, because in principle, if we are using quantum computer, that's because we have a Hamiltonian, which is too big to be handled by a machine, but since, here, we're looking on, only at two by two Hamiltonian, we can afford to. And, so, we construct the matrix, corresponding to the Hamiltonian. And, then, we can print the eigenvalues, for instance. So, let's do that. And you see here that it has, since it's also with a four by four Hamiltonian, here, we have two cubits, and you see we have three eigenvalues, and the lowest I can value is minus three. So, now, the goal of the exercise is going to be to find our quantum states that approximately has an energy of minus three. Everything short of minus three is going to be not so great. We are going to- So, that's our goal, is to find quantum states, the quantum state that we're going to run on our QPU,

and adjust the angles of, in order to find minus three. So, that's the goal of the exercise. So, now we know we have a Hamiltonian. We want to find the ground state energy, which is minus three. And, for this, we're going to use the variation method. And that only consists in constructing a clever circuit. And from this clever circuits, with some parameters, which are going to be the angles of some gates, we're going to adjust these angles, with classical minimizer, and, hopefully, we find an energy which is close to minus three. So, for this, we have to devise a clever ansatz. Or, ansatz is another word for, variational circuit. And here, what I did is I already have qubits by creating a circuit.

That is not so smart yet, but it's not so stupid, either. And it's going to be a circuit with two parameters. So, maybe, what you could do together with me on your side is add comments, or take the dots that I put, and replace them by two. So, that, here, we are going to play with two parameters. And what is special about the circuit we're going to create is that it's a parametric circuit, meaning the angles in the gates are not specified. I do not say it's by half or by four, or something, or some other angle. I'm just saying it's a variable. And that's why, here, I have a loop, here. I have a list, where I create some variables that are going to be the variables, inside my parametric circuits, which I called theta. So, I, basically, in this small list, here,

I have two parameters, theta zero and theta one, and these are the parameters I'm going to put into my gates. So, the circuit I'm going to create, is really a parametric circuit, where the angles are not specified. And, then, there's nothing much to be done, in this cell, here, you just have to change the number of parameters to two, just to make it work. And, so, maybe, let's run this, this cell, here. And that basically creates the ansatz. So, now, we have a circuit, which has basically two rotation, two wide rotations with some undefined angles. And, so, now, maybe, if someone in the chat wants to comment on this, feel free to comment, and, maybe, you can tell me whether you're optimistic or pessimistic, that we're going to find the right answer.

That's that. That could be interesting. So, maybe, you don't know, a few who are pessimistic, you can put some thumbs up, or something, in the chat, and we can check what you guys think. Let's see. A-ha, you don't want to take, to take sides. Uh-huh, so we have Eesh, who took a guess.

So, anyway, let's see. Let's sit together, a bit, how we work. So, what I propose you to do is now go back to, so, just run the sale with this very simple ansatz circuit, with two one qubit gates, and, then, we're going to run the next cell. So, in the next set, what we do is basically what we did before. Mainly, we create a job which has the observable. And, in this case, the observable is the Hamiltonian we want to find the constant energy of. So, that's the Heisenberg Hamiltonian.

And here, this is optional, so, I could even do without it. So, I could basically, just write like this, I have a circuit already. This is my variational circuit. So my job now contains the variational circuit, plus a Hamiltonian. So, it's ready to be set to a QPU, but I have to specify the initial value of my parameters. So, here, what I can do, for lack of a better idea, I can say that my initial parameters, I have two of them, because I have two rotation gates, so, I see that zero is going to be zero zero, as an initial guess. And, then, I just call up my default QPU.

And, here, what I'm going to do is create a stack, a quantum stack, that can handle variational job. Because, if I were to feed a parametric circuits to a normal QPU, it would say, "Hey, I don't know the angles, I don't know the angles you want me to use," because I didn't specify the angles, since at this stage, the angles are our variables. So here, what I do is that I add I type in front of my QPU, what we call an optimizer, which is going to be something which is, which has here under the other line implementation, which is a Python Scipy implementation, which is going to know. So, these guys are going to know how to optimize the angles in order to minimize the value of the observable on the final state of the circuit. And, now, we can basically submit this job to this QPU, which is an enhanced QPU, with the capacity to handle variational drift. So, let's do that. Okay, and, now, we find, you see that we find minus one, at least I do.

Maybe, you don't, maybe, you find something else. And, so, here, maybe let me ask you, why do we, are we happy about minus one, and how can we do better than minus one? And, so, maybe, let me, let me now switch to the chat, to take a look. So, can anyone here tell us, maybe, if they have a good idea of how to do better than minus one here, as a variational energy.

Don't be shy. So, let's wait ten seconds or 20 seconds. And, maybe, waiting for you to think about that, let me go back to the screen. And I can also plot the optimization traits, which means what are the values of the angles that the classical optimizer has chosen? So, you see here that, as a function of the optimization steps of VQE, we went from one, which was the value of the energy corresponding to our, to my initial guess for angles, zero, zero, to something, which, so, I'm going down to minus one, but this is far from what I would like to get, which is minus three, as we saw, as we just saw together.

So, we're still far off the mark, and we would like to have a better idea. So, now, I'll let you tell me. What I've used, you have to find a better value for the energy. Yeah? So, Eesh is suggesting that, maybe, we should choose a different set of, I guess, initial angles. So we can try. So, I mean, maybe, let's try it together. So, here, I can, I could try to start from a different starting point. So, I could say, let's say, let's start by half, and by half, for instance, just to start from a different point. And you see? Here, I still find minus one.

And I can write the trace. The trace is pretty similar. Of course, I could try it something else. So, in my experience, I think this will not help, because something in the ansatz circuit is missing. There is a key ingredient that we didn't include in this circuit. Does anybody have a hunch of what we should put in the circuit? So, at the moment, the circuit is a very simple circuit, where we only need to get- So Mhinzhao uh-huh. So, Mhinzhao is saying we're missing Hadamard gates, and Sahil says, maybe, a two qubit gate would be a good idea. So, I would agree with Sahil, because, if we put only one qubit gates, of which Hadamard is one example, the states that we're going to create, are going to be product states. They are going to be set for both states,

which is something that, for us, is not such a great idea, because we know that the runset of Heisenberg is an integral states. And the only gates that can create integrement are two qubit gates. So, maybe, let's follow Sahid's lead, and look at what we obtain when we do that. So, let's go back, and, maybe, here, let's do the simplest gate we can do, for instance, let's do a CNOT gate. So, here, I'm going to place the CNOT gate.

So, that means, here, I need to specify, on qubit one, and the steps for the control qubits, and the target qubit is going to be qubit one. So, here, I'm just adding a CNOT gate between zero and one. So let's see, let's see if that works, and I encourage you to try them, yourself. So, let's run it again. Aha. So, now, we find minus three, which is what you were looking for. So that was a good suggestion, and let's look at what we obtained. Aha. So, now, yo see, we've started from the same starting point, one, and then we went down to minus three, pretty quickly, at least. So that, in the few steps, we went to the minimum energy. So, right now, we know that we have found our exact energy through VQE.

Okay, now, that was the easy part of the tutorial. Maybe, before I go to a noisy QPU, it's a good time, maybe, for you to ask questions. So, maybe, then, we go back question view. So, if you have questions, now, feel free to ask, or else we'll use the last 10 minutes to, now, do what happens, see what happens when we do noisy simulation. Okay. I see no question so far. So, let's go back to the tutorial. So, here, what we're going to do, is use a very simplistic noise simulator, which creates depolarizing noise, after each gate. So, if you want to look up the theory of what depolarizing noise is, I put some explanations in the cell, here, to explain to you what it is, but let's, for now, just remember that this is a very simple noise that you could put in here.

What this simulator does is it adds depolarizing noise after each one and two qubit gate. And, to achieve that, we just type what we call a depolarizing plugin in front of a perfect QPU. And that creates what we call a noisy QPU. And this is noisy QPU is going to work exactly the same way as a perfect one. Mainly, it takes a job as an input and spits out a result. But it's a way to include some errors, here, if they're simplistic, and it's also going to be quite slow, because it's going to run on your laptop. But, nevertheless, it's going to give you an idea, whether your VQE still works.

So, what you can now do is run on this cell and, also, you can run. Okay. So, now we get to work a bit. So, now that you have run this cell, we can copy paste the code corresponding to the perfect QPU, here. So, here, I'm just copying cell number 11. Well, it's not, probably not, number 11, but that's the one under creating a variational impartial stack. So, I'm just going to copy this guy, here, below here.

I'm going to just copy and paste it, just below the place where I defined the noisy QPU and I'm going to replace, so, take a look at what I'm doing now. So, I'm taking this line here, where I wrote that the QPU was optimizer scipy_linalg_qpu, and I'm going just to replace linag_qpu with noisy_qpu. So the code is exactly the same. I just changed QPU, and, now, I'm going to run it. And it's going to take some time, so I'm going to let it run, now. It's going to take a few minutes, because it's a noisy simulation, so it takes much more time, especially here, too, stochastic simulation. So, you have to sample several times. And, not only is it noisy, but it's also variational, which means I'm repeating the same computation over and over again. So, that's why it's going to take time.

So, while it's running, and I hope it's also running fine on your side, we can chat, and I can tell you a few more words on what you can do next, because this is basically the end of what I wanted to show you. I put a small, a few bonuses, that you may want to play around with, which include, if you want to add systematic errors, as opposed to depolarizing errors, there's a very simple trick to do it with this tutorial. And there's a second bonus, which is here, we tried the very simple Hamiltonian, because Heisenberg Hamiltonian. So, you may be suspicious that I just looked up an example that's going to work because it needs to work for a tutorial. But, in fact, here, I created a function that creates a random Hamiltonian which can act on any number of qubits

and any number of terms. So, and with it, this Hamiltonian, you can test everything we did before, and check that whether your ansatz circuit, your variational job, works or not. So, I urge you, also, to try that out, and check whether it works with a perfect QPU, and whether it also works in the presence of others. And, so, what you could do here is one sense. Once you see that it kind of works, you could crank that up the noise level, and see what happens.

And things you may want to be looking at is, for instance, if you look at the curve, here, which was the convergence of the energy with respect to the number of VQE steps, you see here that in a perfect case, not only did it convert to the right value, minus three, but it also converged very fast, in a couple of steps. So, one thing you may want to look at, when we do noisy simulations, is, does it converge to the right value? And, how fast is it converging? And if it doesn't converge with the right value, does it converge fast to the wrong value? And that's something that we, as quantum engineers, are very interested in. So, here, on my side, it's still running, but that's, maybe, then, a good timing for us to go back to the chat, and for me to take questions, if any.

So, waiting for your questions. Something you may want, also, to try, which is very easy to do, is, now, take this code with the QPU, which is at the moment, a simulator, perfect simulator, or a noisy simulator, take this code and just replace the QPU with the Qiskit QPU that I showed you in the slides. So, here, let me show you the slides again. So, here, you see, here, that I just imported these backend to QPU.

And I created a QPU, where I use my IBM token, and I selected a machine on IBMs machine. And this is a QPU which you could also use in the tutorial that we just did together, and that you can submit a job to, in the same way that I submitted jobs to the QPU, before. And that could run on IBM's cloud, IBM Quantum Experience, and return results, and that will actually do you a VQE on IBMs machine.

And you could imagine that you would do the same thing with Rigetti We also have a connector to Rigetti's machine. And if you have access to an experimental quantum processor, you could also write to small API in order to make it a QPU for our interface and just use your code with the same QPU, without changing anything but the QPU in your code. Okay, Alex, is that, he's asking, the randomness of, for example, the numpy random, to get, adequate, for very, or other situations, which things like hardware based... So, at this stage, I would say, this is not our biggest concern. So, indeed having a good random generator is important. And we know that, on classical computers, these are only pseudo random generators. So, in principle, at some point, we should pay attention to this, but the problems that we face, at the moment, with bottom hardware,

are much bigger, in terms of imperfections, of errors. These are really problems that are orders of magnitudes more important than having some issues with the pseudo randomness of your networks. So, that's, in principle, a fair question, but, in practice, this is really not the first priority that people have, at the moment. And you can check that, in this tutorial, if you put a noise level, which is even not so high, you will see that the energy that you get, at the end, is already off by a couple of percent. And, maybe, I can check if it has finished running on my computer. Not yet, it's still running,

but if we were to wait long enough. Ah, here it is, this, so here. Now, I have the result of mine, on my computer. So, you see it, here, that the final energy that it finds is minus two point 77. As we see, I already have something which is quite far off the mark. And I could, let me do the plots, just to see the convergence, so that you have an idea how it converges. So, here I just take the same down, copy and paste. Let's look together. So, you see, here. Okay, the speed of the convergence was the same, same speed, more or less, in ten steps.

So, anyway, it's time for me now to conclude. So, this simple tutorial should have given you an overview of what you can do with myQLM. I urge you to go take a look at the documentation, and try out the ideas that I put in the notebooks. I'll give you my email address, in case you want to, you have questions, or you want to go further, or for any questions. I put it here in the chat. So feel free to reach out to me, in case of any questions, regarding this tutorial, or what you can do with myQLM. I'd be very happy to answer.

And, with this, I think I'll give back the floor to Yuri, and thank you, Yuri, for telling me when I was disconnected. Paris is very far away from Chicago, as we discovered, today. (Yuri laughs) - [Yuri] Yes, we did. Now, we are going to switch, and we are going to Danylo Lykov. He is going to talk about Qtensor. - [Danylo] All right. So, I'll be talking, today, about the project I've been working on for the past, I think, two years. It's the Qtensor, and it's a tensor network, quantum simulator, and mostly focused on QAOA simulations.

So, just a small introduction, probably, it was covered before, but quantum circuit simulator is used to simulate quantum algorithms on a classical device. And the goal of this simulator is, usually, simulating the probability amplitudes or expectation value of some observable. And we might want to use quantum simulators, for a variety of reasons, such as finding variational parameters for the variational algorithms, or debugging quantum algorithms, or checking the quantum hardware.

So, here's a general simulation workflow that Qtensor uses. And I will go through each conversion. So, first, we start with a QAOA problem, such as MaxCut, for example, and we convert this problem into a quantum circuit, or a sequence of quantum circuits. I will stop on it later. And, then, each of those, we convert to a tensor network. Now, then, we want to contract that tensor network, and we want to contract it in the most efficient way, as possible. And we find a contraction scheme,

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent