Inspiration

When first thinking of an idea for my project, I remembered the spark of curiosity I had when setting up my first Jupyter Notebook to run a quantum circuit on a real quantum computer. It was just 2 or 3 lines establishing a pass manager, running a transpilation function, and visualizing the result, but with those few lines, the abstract and relatively simple circuit we had prepared evolved into a mess of simple repeated gates with finely tuned parameters. For the first time, I had witnessed the immensely complex but necessary step of quantum transpilation for quantum circuits. It was difficult to mentally follow, and that intrigued me more than anything else. I have played around with classical logic circuits and how to make certain logic gates from more fundamental gates, but the process of quantum transpilation seemed infinitely more complex than the variety of discrete representations of classic gates.

What it does

My project is relatively simple, but it focuses solely on transpilation, specifically the effects of different levels of optimization of the default transpiler on a triplet of distinct simple abstract circuits. The notebook displays LaTeX representations of the various quantum circuits at different levels of transpiler optimization. It also contains some commentary/analysis from me on the differences in the resultant transpiled circuits between optimization levels. It does all of its transpilation in relation to the target requirements of the ibm_torino backend.

How I built it

I built this project first, starting with an in-depth dive into the IBM Qiskit Transpiler documentation in the time I had given myself. From there, I solidified the code that would consistently select ibm_torino as my back end to ensure my transpilation always followed the same target. Secondly, I started developing the various circuits that I wanted to test the default transpiler on. I made a circuit dealing with non-local qubit interactions, a circuit which tackled the transpilation issue of multi-qubit gates larger than 2, and a circuit which primarily focused on how non-native gates would be transformed during transpilation. Once my circuits were established, I did not have much time to dive as deep into transpilation as I would've liked. I settled upon varying the optimization level of the pass manager, and analyzing results through the lens of what I had learned from the documentation about the stages of transpilation, and the additional functions/optimizations run with higher optimization levels declared.

Challenges I ran into

  • I faced challenges declaring ibm_torino as my only backend. Documentation was unclear, and for a while, I was unsure of what in the QiskitRuntimeService would hold the quantum computer that I wanted to transpile for. With the help of Ruben, he was able to cut this hiccup short, pointing out I already had the proper function to declare ibm_torino as my backend
  • I faced hard time constraints, which affected the depth of exploration into transpilation that I could do. While there is nothing that can be done now about time, it made me heavily consider what I could and could not achieve in the time I have left. But I am proud to say that I at least have a functional and complete project.
  • I faced large gaps in knowledge in the topic of transpilation. I spent about half to 2/3 of my time simply learning about the topic. Coding was a rather simple element once I had determined what circuits to implement and established my consistent backend. Even now, I wish I knew more about transpilation so that my project could've gone a bit more in-depth.

Accomplishments that I'm proud of

Overall, I am proud of a couple of key aspects of my project:

  • It is complete, in the sense that nothing is half implemented or missing. It is complete as is, even if it may be a little short or shallow
  • It is functional. The code should be able to work just by adding an API key with access to ibm_torino. Additionally, for any unresolved issues I faced, I was able to find sufficient workarounds.
  • It is submitted. One of my biggest goals for this hackathon, since it is my first, was to simply participate. I am happy to have just submitted something on such a complex topic from which I have gained a great deal of knowledge.

What I learned

Specifically on transpilation, I learned about the 6 general stages of transpilation that the IBM default transpiler uses. I learned about pass, pass manager, and staged pass manager objects and their relationship to each other. I was able to analyze the effectiveness of transpilation on different circuits, such as witnessing how simple connectivity issues can be resolved in the layout stage, or how multi-qubit gates result in depth and resource-intensive transpilations. In fact, the simple Toffoli circuit exemplifies just how difficult multiqubit operations and entanglement can be, and opens up a lot of potential questions and ideas for future exploration/testing.

What's next for the Exploration of Quantum Circuit Transpilation

To continue this project, I foresee a great return to the IBM documentation on transpilation, specifically on the pass, PassManager, and StagedPassManager objects themselves, so that I can go beyond using the basic transpiler. For this project, as a result of my limited knowledge of these fundamental transpiler objects, I was limited in what I could do to visualize, break apart, or explore the topic of transpilation. The next step in exploring transpilation is truly isolating, dissecting, and understanding all that can be done at each stage of transpilation. The circuits I used as examples in this project only scratch the surface of the purpose and usefulness of each of the 6 stages of transpilation. In the future, I hope to create my own transpilers, which may optimize for different metrics, and compare the results, runtime, and effectiveness of each. Further testing is critical to exploring the topic further, but this also requires a better knowledge of Python itself to set up such environments for testing.

Overall, the next primary step is to dive back into the documentation, returning to this project for further experimentation and observation of all that I read about.

Built With

Share this project:

Updates