A revolutionary approach to building quantum circuits

A revolutionary approach to building quantum circuits

Show Video

- Hello, everyone. And thank you for joining us today on this webinar brought to you by Classiq, the quantum algorithm design company. My name is Yuval and I'm chief marketing officer for the company. And together with me today I have the honor of introducing Amir Naveh, co-founder and head of algorithms. Hi, Amir. - Hi, Yuval.

- All right. So we've got many, many people waiting for us. So why don't we get started? So today we're gonna talk about the difficulties and the solutions of building quantum circuits. Why is it difficult to build quantum circuits? We'll see how functional models can help build sophisticated circuits, circuits that we believe could not be created otherwise. We'll tell people how they can get started with using the Classiq platform if they want. And to the extent we have time, we'll take questions from the audience.

Please feel free to submit questions in the questions panel or on LinkedIn Live if you're there. And if we can't get to them during the live broadcast, we'll make sure to get back to you by email or LinkedIn as quickly as possible. So we've all heard the hype about quantum computing, how it's gonna be transformational to so many industries, whether it's financial services or supply chain, how it's gonna help us with solving the green energy issues. And we think it's true, but it will take some time and it will take some problems that we need to overcome. We think there are three main problems that need to be solved. First, the hardware is not strong enough.

IBM announced a 127 qubit machine, and that's wonderful, but generally speaking, anything you can run on a quantum computer today, you could run on a classical machine. But as we go into next year and the following year, we'll start seeing a chasm form and then expand between what you can do in quantum and what you can do in classical. And if you have an algorithm that's expressed correctly on a quantum computer, you may be able to get amazing results. And that's why so many companies are building quantum teams and getting ready, and they're facing that second issue, a shortage of talent.

Because today very often, you have to have almost a PhD level knowledge of quantum information science to be effective in writing quantum algorithms. The third issue, which we'll spend the bulk of the time on, is the difficulty in writing quantum software. So how is quantum software written today? You usually start from a preexisting scheme, a recipe or an algorithm.

I'll show one in a second. You then work to implement that recipe at the gate level or the building block level. You basically find the building blocks and try to put them together in a way that implements each of the steps in the recipe.

Then you try to bring everything together, and then you have to modify or optimize the circuit to make sure it all goes well. And this may be doable when you have 5 or 10 or 15 qubits, but gets increasingly difficult when you have 50 or 127 or 400 or a thousand qubits into the future. Here's an example of such a recipe. This is an article that was published not too long ago by Goldman Sachs and University of Maryland and IBM. And it talks about the quantum algorithm for derivative pricing.

And a big part of this article, as you can see on the right, is sort of a recipe, something that says do this and then do that and apply "and" and "or," and control, copy and so on and so on. And now as someone who wants to implement this algorithm, you have to go and do every single one. Well, here's why it's hard. Because when you take each of these steps, you're faced with a number of difficult decisions.

The first one is how do I implement it? Even a function like "I have two quantum registers and I want to add them together", well, you could do a QFT adder or you could do a ripple adder or maybe you could do something else. So you have to choose which implementation you're working with. You have to decide on how many auxiliary qubits you're using. Typically when you have more axillary qubits, you have more flexibility. You can make a shallower circuit, which is good.

But this raises other issues we'll see in a second. You have to decide on the appropriate level of approximation, whether you're initializing qubits to a certain value, or you're trying to approximate a Gaussian distribution for financial services, how accurate do you need this to be? And how many quantum resources are you spending to get to that level of accuracy? But then when you're trying to put everything together, you get into system-wide constraints. I only have a certain number of qubits, can I fit my algorithm in them? Qubits are noisy, so I'm limited by the depth of the circuit.

And I can only afford this depth and not more than that. If I'm using auxiliary qubits, and especially if I want to reuse them downstream, I have to clean them up. I have to uncompute them. You can't just reset an auxiliary qubit to zero, because it may have previously gotten entangled with another qubit. So you have to uncompute to unwind it. And then a whole bunch of hardware issues. You know, what is the preferred gate set? And so on and so on.

The big issue, the heart of the matter, is that these two sides are deeply interconnected. The block level decisions implement the system-wide and the system-wide constraints implement the block level decisions. You may say, "I have too many qubits. All right, well, I need to change the way I'm implementing." "Oh, I have to reduce the number of auxiliary qubits." "Oh, should I, or should I not do this? Can I put these blocks in parallel? Can I put them serially? Can I swap the order?" There's so many decisions you have to make, and as the computers grow, these are becoming so and so difficult that are basically not possible by most humans.

And so we offer a different approach. You take that recipe, that preexisting scheme or algorithm, and then instead of coding it, instead of coding it in the gate level or picking a predefined block that someone wrote for you, you define it as a functional model, as a functional model with the appropriate parameters. So here is the Gaussian function that I want, and here are the Gaussian parameters. Instead of saying, "this is how you do addition for qubits."

Just say, "I want to add this and that." And then you also specify the constraints. What is it that you care about? Whether it's the gate set or the number of qubits or the depth of the circuit or the accuracy, and then let our platform do the rest. Our platform then explores millions and sometimes billions of different options and looks for all kinds of permutations and all kinds of implementations and all kinds of trade-offs and tries to find solutions that meet the requirements that you want and the constraints that you care about. And we automatically generate an optimized circuit, if one can be done, from your functional constraints, functional model and the constraints.

So at a very high level, we have a synthesis engine that takes two things as input, a high-level model and a constraint. It generates code in Qiskit or Q# or Cirq, and then allows you to easily either run it on a simulator or deploy it on one of the many cloud providers and hardware providers that we already integrate with. And in short, we allow you, the designer, to focus on what is it that you want the algorithm to do, and let our platform automatically take care of the how, the specific implementation, the specific optimizations. So you can get the most out of your quantum hardware.

So, Amir, I think this is a great time. I think you have some demonstrations to show us, so how does this work? - Thank you, Yuval. So everyone who was joining throughout Yuval's introduction, my name is Amir, and I'll walk you through a demonstration of the platform showing you how to create and use, create functional models and use the Classiq platform in order to generate optimal circuits. So let me start by sharing a short presentation, just one or two slides. So the agenda for today, first we'll try and explain what functional level models are, how in the Classiq method you define how the circuit behaves.

We'll do this then on some very specific applications. So we'll show a 3-sat solver that is implemented using the Grover's algorithm at the functional level. We'll also show a financial use case. We'll show some optimization use case, using the QAOA algorithm. If there's time, we'll also show how this can be done on a few more algorithms, and then finally summarize the benefits. So let's start with what are functional level models? And this is maybe the thread that goes through everything that is done with the Classiq platform.

So if you have this scheme of how you want the state vector to behave, or your quantum circuit or algorithm to behave, you can, in almost all cases, break it down into building blocks. So for example, you start off with the state preparation, which is a simple function. Then you take the outputs of the state preparation, and for example, put them into a quantum adder. This could be any adder.

It could use a quantum Fourier transform. It can use a ripple carry. It can have any number of auxiliary qubits. And then this can be treated as a functional block in itself and can be used within the scope of a larger circuit. So here we have a larger circuit consisting of two of these Q adders, and of course this can become a sub circuit for an even larger circuit.

So when you're defining the circuit in this way, and of course you need to implement all the different blocks, and their different implementations, then you can have many levels of flexibility, which we'll show throughout the demonstration. So let me show how this simple example works out, and then we'll build up to more interesting and complex examples. So this is the most basic model that you can create with the Classiq platform. Here we have a state preparation function. It's one of many functions that are pre-implemented within the Classiq platform. So if you want to use this, you don't need to implement it yourself.

You can just run it. Of course you can control the values of the state which you're preparing. This function will load these eight data points onto a register of three qubits. And it's using four qubits, one qubit as an auxiliary qubit. And also you can define the level of error for this function, so you can control the accuracy.

What happens is now, so this is the model. And now what I want to do is to generate the circuit. So let me just, sorry, let me just move this. Okay. So I press here generate quantum circuit. Let's call it state prep 1.

Of course, it needs the authentication. And then I get a quantum circuit. This is a circuit that we are familiar with at the gate level, with all the individual single qubit rotations and two qubit gates.

And in this case it's output is in the QASM format, that's the IBM format. It can also be output as Q# format, which is Microsoft, and all other gate level formats. And you can play around. You can control the accuracy. So if I require a more flexible accuracy and I generate again, then I will get a much shorter circuit, because I am allowing it to correspond to a lower accuracy bound. Right, so that is one function. So I've created the state preparation function and I've created a quantum adder, and then I've created these composite functions.

And here is a more complex model where we already have this state preparation and the quantum adder. And these are defined just as in the picture I've shown in the presentation earlier. So we see we have a limit of 25 qubits. We're constraining the depth of the circuit. We have all of these different functional blocks and how they're wired to one another.

And then I can press generate. Let's call it Q2 adders. And I will get the circuit that is implementing this whole functional model, right? So it's a larger circuit and we have, again, the quantum assembly for the circuit, and here were already many design choices, how to reuse the auxiliary qubits, how to manage the accuracies over all of the state preparations. So the next thing I want to show you is because this is hard to visualize, it's hard to see how this circuit corresponds to the model we've seen earlier.

So part of the Classiq platform is an ability to interactively visualize your circuits. So here we have the interactive visualization that was created for this model. So it's called Q2 adders. And within it we see both of the individual adders and we can open these up and see the state preparations and adder, just as were defined in the model. And then we can open each of the individual functions, and this is already the gate level implementation.

So here is the implementation of the adder and here is the implementation of the state preparation, et cetera, right? So we can kind of view the circuit at any level of hierarchy we want. And this is the output of the synthesis engine after all of the optimizations. So that's a simple hello world example.

And what I'd like to share now is how we can build from these functional models things that are increasingly more complex and that are either very hard or impossible to design manually and of course, to optimize manually. So let's start with a basic example of how we would want to do quantum arithmetic. This is a basic part of many different functions.

I'll show that throughout the demonstration, quantum arithmetic is a very basic building block, not only when you're creating, for example, custom oracles, but also when you're doing optimization problems or for many use cases, such as in which you value showed for doing risk analysis, option pricing, almost always, you need some sort of classical logic within the circuit. So this is a good introduction example. Let's see what we get here.

So we run this simple expression, A times B equals 6, again, within the Classiq platform, the multiplication and comparators are implemented. So this, you can just plug and play. I'll emphasize this later on, but you can build your own functions.

You can also add your own custom functions, which Classiq doesn't need to know about, but the engine can still work with them if they're in the correct interface. And then let's see what we get here. So this is, again, sent into the synthesis engine.

It's running on AWS on the cloud. And we can see at the functional level that we have a multiplication block, an equality block, and then the dagger, right, the inverse of the multiplication. And we can open these up and we can see that within this multiplier, it's implemented with a quantum Fourier transform, so we can open up the quantum Fourier transform, and we can view all of these intricacies within the multiplier if we want. But we can also stay at this functional level where we see, okay, it's being computed, it's being uncomputed so we can later on use these inputs again.

So that's a really basic example. Designing this by hand, if you have the multiplier and the equality quantum functions is possible. You can do a simple circuit like that. But now let's move forward to some more complex examples. So what I've done here, it's fundamentally, it's the same thing.

So I've defined an oracle, an arithmetic oracle. And again, all of these are functions. The "and" is a function. The comparator is a function. This expression here, which is "or" is a function. So this defines an arithmetic function that is implementing a very known problem known as a three satisfiability. So here actually, it's a Grover oracle for solving this 3-sat problem.

And here it's a simple problem. Later on I'll show the truth table for this problem and show how you can solve it within the Classiq platform. But what's limiting us from doing this only with six clauses and not 600 clauses is simply the number of qubits. So we can do a full 3-sat problem with the Grover algorithm using this framework. Of course, it won't give an exponential speed up, only a quadratic one because that's how Grover's algorithm works, but still quadratic can sometimes give big improvements.

And I mean, that's what a Grover algorithm is able to do. So we can run this. And then if I just show the circuit, so I'm guessing this could be maybe one of the more complex circuits, many of you have ever seen.

So it's working on 20 qubits. And each of these is a block, right? We have these equalities and then these or gates. All of them are the gate level implementations of the individual functions.

And it goes on and on like that. The total depth of this circuit, actually, we have it. So I don't remember exactly.

But notice that many of them are like equal 26 and some of them are daggers, right, equal 8 dagger. So what it's doing, it's uncomputing as the algorithm moves along, so it's freeing up space. I'll show in a minute how, if this was done naively, it would have taken not 20 qubits, but 35 qubits. So the synthesis engine is able to optimize here from 35 to 20, and this is just because it's a small example. In larger examples it really improves this by orders of magnitude. So okay, let's just do a quick detour to how it would look naively.

So here it's the same circuit with 35 qubits. I've prepared it in advance and you can see it's looking the same, but it starts with all of these without the uncompute, and then it's doing the uncompute at the end. This is the naive implementation, but it would take much more qubits, and you really don't want to worry about it when you're designing the oracle.

I mean, it's kind of impossible to worry about these things when it scales. Now, what I wanted to show here is that you have the circuit, so we can print out the depth. In this case, it's 329.

And then we can also actually run this circuit. So the Classiq platform is integrated with all major backends. All the IBM backends, all the backends in AWS, in Azure Quantum as well. So many of our customers are using these different hardware backends to run the circuit.

You don't need to use anything else in order to run them. And then you can just print the result that you get from actually running this, in this case, on the IBM simulator, AerSimulator, and you get a result. X1 equals 0, X2 equals 0, X3 equals 1.

This is actually the result from running on an actual simulator. And then I kind of, I created the truth table for this problem, and you can see how indeed X1 is 0, X2 is 0, X1 is 1 evaluates to true. So it's a valid solution, so Grover's algorithm works. Which maybe shouldn't surprise us that much, but it's nice that everything happens and it's actually practical.

So just before I move on to other frameworks from the Grover, I did want to show like a more concrete use case than 3-sat. I mean, 3-sat is a really important problem. You can map any NP-complete problem into it. But just, I did want to show, so when you're doing credit risk analysis, for example, and many other financial use cases, so it's using an algorithm called amplitude estimation. And then, so we've done this. This is like preliminary work we've done with some of our customers.

And you can also see this at the functional level, and you have the state preparation, which is again, a Classiq built in function, and you create all of these other functions. So you have a weighted adder, which is also quantum arithmetic inside. And then you can kind of play around with this circuit, and it's optimizing on the accuracies, it's optimizing on the number of qubits, it's optimizing on the depth and you get a circuit that you can run much faster on practical hardware and simulators. So that's a big advantage.

Right. So to move forward to one more example, I'd like to elaborate on, and then we'll kind of wrap things up. So max cut. This is also like kind of a textbook example. It's a good example for one of many optimization problems you can solve with quantum computers in general, and with Classiq in particular. The problem is, for those of you unfamiliar with it, how to divide this graph, in this case with 10 nodes, into two sets, such that the cut between the sets is maximal.

And this is typically solved with the QAOA framework, which is an iterative algorithm, and each iteration kind of maps this optimization problem into a circuit with many layers. So let me show how this looks and then explain how the Classiq platform comes in handy. So first you're looking at this, I mean, if I just open all of these up at the gate level, you're not going to be able to understand anything. So happily you can understand in this way, how the QAOA algorithm actually works. It has an initialization layer and then five layers of cost and mixer.

But specifically when you look at the cost, you have many local terms, 2 qubit gates. But the order doesn't matter, right? You can choose the order of these gates in any way you choose. So even on this small example with only 10 qubits, you have 15 factorial possibilities, which is 10 to the power of 12 possibilities how to order these different gates. And doing it optimally, so the Classiq platform is able to bring you to a much, much shorter depth. So just as an example here, if I print the circuit depth, I get 25. but if I don't optimize, if I don't require the depth optimization for this problem, let me just rerun it again quickly.

So this is the non-optimized version, and then you can see the cost is deeper and you can see that the circuit depth is 39. So again, it looks maybe not so significant from 39 to 25, but when you go up to a hundred qubits it's orders of magnitude, and this is impossible to do manually. So these are all things that you can only do at the functional level. There is no other way to do it. So I have a limited amount of time. So I want to show just the picture, and I won't explain how Shor's algorithm can also be implemented using this framework.

So let's just view the circuit here. I've prepared it in advance. And Shor's algorithm is a very known algorithm, but when you look at the details, you're doing modular exponentiation, which is a complex arithmetic circuit in itself. So over here, you have wide, wide variations of optimizations to do. And when you're working with the Classiq platform, you can visualize it and optimize on it. Right, final thing here is that I mentioned all of these built in Classiq functions.

But really you can create anything you want. So if I just start from the beginning, this is the notebook you would have if you just "pip install Classiq" and didn't do anything else. And then you define your own function library, it's empty. And then you can just define, in this case, a really, really simple function.

So for example, a bell state function, just doing Hadamard and then CNOT. And well, first of all, you can actually see the circuit generated, right? It's the familiar bell state, the Hadamard and then the CNOT. And you can see that your function library suddenly grew. You now have bell state. And you can build these composite functions and expand this more and more indefinitely and really create your own world of quantum algorithms using this framework.

So those are the examples I wanted to share. And I think maybe the important part here is to emphasize, again, the flow and more importantly, the benefits. So what we're doing is we're proposing a new way to design quantum algorithms at the functional level, specifying the constraints, and then out of billions of possibilities a specific gate level circuit is synthesized. And you can also analyze the circuit at the functional level and see how it corresponds to the model.

And this framework gives you benefits that are impossible otherwise. So first you're finally focusing on the functional level algorithm. You're focusing on the flow, you're focusing on what needs to be done and not on which implementation of an adder you're choosing right now. Implement once all the different implementations or use Classiq's built in functions and never think about it again. Then this is scalable.

I mean, when we're talking about hundreds or thousands of qubits or more, the problems that I showed, even wiring together the circuits, it's impossible to do manually. But even harder is doing all these functional level implementations, choosing the right order of the functions or optimizing on the uncomputation methods or the auxiliary qubits. You can't do that manually. And it turns out that these give orders of magnitude differences, so a circuit that would have cost you maybe a thousand qubits, you can now reduce to several hundreds, and then you can run much faster on real quantum hardware. So this accelerates your time to available actual hardware. You reduce your development time in your whole development cycle, and also, well, I mean, you get this platform and you built all this IP and quantum know how within your organization, your own models.

So I think that sums up my part and back to Yuval. - Thank you very much, Amir. That was fantastic. Classiq is a software company. So our goal is to sell software licenses. These are priced usually annually, and our goal is to make you self-sufficient so you can develop your own IP, your own circuits without being dependent on us.

For those that are interested in trying out the Classiq platform, we started an evaluation program and we have several companies that are already exploring all the wonderful things they can do with quantum. Just go to our website at the address on the screen, Classiq.io/request-an-evaluation, and we can get you started. If you have any questions, please email hello@Classiq.io.

That's classiq.io. And we hope to see you at future events. Our next event is Q2B Conference next month in California, and we'll have additional webinars and additional useful information for everyone that is interested. Thank you so much, Amir. And thank you everyone for being here today.

- Thank you, Yuval.

2021-11-29 09:53

Show Video

Other news