TorchQuantum Tutorial @ ISCA 2023: A Fast Library for Quantum Computing in PyTorch



Parameterized Quantum Circuits (PQC) have attracted much research attention because of their potential to achieve quantum advantages on the current Noisy-Intermediate Scale Quantum (NISQ) computers. Quantum Neural Networks (QNN) for Quantum Machine Learning (QML) and Variational Quantum Eigensolver (PQC) for molecular dynamics are popular PQC examples. However, there are several challenges for current PQC research. Firstly, the library infrastructure for exploring PQC research is not fast and convenient enough, hindering the development of new techniques for PQC. Secondly, the quantum noise can severely degrade the PQC reliability. Thirdly, the design space for PQC circuit architecture (ansatz) is huge, and it is difficult to find a good one efficiently. The TorchQuantum library and the QuantumNAS framework, published in HPCA 2022, provide practical solutions to the them.

In this tutorial, we will first introduce the basic usage of the TorchQuantum--a general framework for PQC search, construction, training and deployment. All the operations for PQC circuit simulation are implemented with the PyTorch native operators to leverage the supports for GPU acceleration and automatic gradient computations to achieve fast PQC parameter training. We will introduce basic examples on how to construct and train QNN to perform image classification tasks and VQE circuit to estimate the ground state energy of molecules. Secondly, we will introduce the QuantumNAS framework to search for the most noise-robust circuit architecture efficiently. The search is performed with real hardware feedback in the loop to find the circuit most resilient to noise. Then, for highly scalable training of PQC, we will introduce how to train PQC on real quantum devices with the parameter shift rule. Finally we will introduce PQC compression which reduces the size of circuit by removing redundant operations and introduce the pulse-level support of TorchQuantum.

For each section, we will provide hands-on experience in implementing PQC and running on real quantum machines. We will also discuss the existing difficulties, and show our perspective of PQC, especially Quantum Chemistry and QML and in the NISQ era. All attendees will leave with code examples that they can leverage as the backbone implementation of their own research.

The TorchQuantum opensource can be found at


Song Han is an associate professor at MIT EECS. He received his PhD degree from Stanford University. He proposed the “Deep Compression” technique including pruning and quantization that is widely used for efficient AI computing, and “Efficient Inference Engine” that first brought weight sparsity to modern AI chips, which influenced NVIDIA’s Ampere GPU Architecture with Sparse Tensor Core. He pioneered the TinyML research that brings deep learning to IoT devices, enabling learning on the edge (appeared on MIT home page). His team’s work on hardware-aware neural architecture search (once-for-all network) enables users to design, optimize, shrink and deploy AI models to resource-constrained hardware devices, receiving the first place in many low-power computer vision contests in flagship AI conferences.  Song received best paper awards at ICLR and FPGA, faculty awards from Amazon, Facebook, NVIDIA, Samsung and SONY. Song was named “35 Innovators Under 35” by MIT Technology Review for his contribution on “deep compression” technique that “lets powerful artificial intelligence (AI) programs run more efficiently on low-power mobile devices.” Song received the NSF CAREER Award for “efficient algorithms and hardware for accelerated machine learning”, IEEE “AIs 10 to Watch: The Future of AI” award, and Sloan Research Fellowship.

Yongshan Ding is an Assistant Professor of Computer Science at Yale University. He is a member of the Yale Quantum Institute (YQI) and is affiliated with the Computer Systems Lab (CSL). Ding completed his Ph.D. from the University of Chicago. He is a recipient of the William Rainey Harper Dissertation Fellowship, one of UChicago’s highest honors, and the Siebel Scholarship. Prior to that, he received his B.Sc. degrees in Computer Science and Physics from Carnegie Mellon University. Ding is also the lead author of a textbook, Quantum Computer Systems, in Springer Nature’s Synthesis Lectures in Computer Architecture.

Weiwen Jiang joined Mason in 2021. Prior to this, he was a post-doctoral research associate at the University of Notre Dame. He received his PhD from Chongqing University in 2019. From 2017 to 2019, he conducted research at the University of Pittsburgh and was co-advised by the professor there for his PhD thesis. He works on hardware and software co-design; in particular, the co-design of neural networks and different hardware accelerators, including mobile devices, FPGA, and ASIC. His recent work brings the co-design philosophy to quantum computing and demonstrates that quantum advantage can be achieved for the neural network for the first time. Jiang’s research works have been published in prestigious journals and conferences, including Nature Electronics, Nature Communications, IEEE/ACM Transactions, DAC, ICCAD, and ESWEEK. He is the recipient of the Best Paper Award in ICCD’17 and Best Paper Nominations in DAC’19, CODES+ISSS’19, ASP-DAC’16, and ASP-DAC’20. In addition, he works closely not only with academic societies (such as Notre Dame, UPITT, Northeastern, Rice, and UConn) but also with industries (such as IBM, Xilinx, Facebook, and Edgecortix). 

Hanrui Wang is a fifth-year Ph.D. student at MIT EECS advised by Prof. Song Han. His research focuses on quantum computer architecture, machine learning for quantum systems. His research has been recognized by ACM student research competition 1st place award, best poster award at NSF AI Institute, Best Presentation Award as a DAC Young Fellow, MIT homepage spotlight and appears in top computer architecture, design automation and ML conferences such as MICRO, HPCA, DAC, ICCAD and NeurIPS. His co-authored paper received ICML RL4RL Best Paper Award. He is the recipient of Qualcomm Fellowship, Unitary Fund, and Nvidia Fellowship Finalist. He is the creator of TorchQuantum library which has been adopted by IBM Qiskit Ecosystem and Nvidia cuQuantum Appliance. He is also the co-founder of QuCS lecture series for quantum education.

I am currently a Ph.D. student in the Department of Computer Science at Purdue University. My advisor is Associate Professor. Xuehai Qian.I received my Bachelor’s Degree from Tsinghua University in 2018, where I was working with Professor. Tianling Ren and Professor. Shouyi Yin. Before transfering to Purdue in Fall 2022, I spent four years (2018~2022) in Viterbi School of Engineering at University of Southern California as a Ph.D. student. My research interests lie in the area of Quantum Computing. I am working on projects that can enhance the performance of existing quanutm devices by decreasing compilation overhead and circuit latency. To optimize the compilation workflow for applications such as Variational Quantum Eigensolver (VQE) and Quantum Machine Learning (QML), different techniques such as quantum optimal control and graph transformer are used.

Dantong Li is a CS Ph.D. student at the Yale Quantum System Lab. His research interests are in the inter-discipline of Computational Complexity, Quantum Computing, and Machine Learning, especially in Quantum Computing for ML, to explore quantum advantages and their applications in the near-term future.

I am currently a Ph.D. student in the Department of Computer science and Engineering, University of Notre Dame, under the supervision of Professor. Yiyu Shi at University of Notre Dame and Assistant Professor. Weiwen Jiang at George Mason University. I received my Bachelor’s degree from University of Wisconsin, Madison in Madison, WI, US, where I was worked with Professor. Juda Shohet in the Plasma Processing & Technology lab at UW-Madison. My research interests recently focus on Quantum Machine Learning and Quantum Optimal Control. My research aim to find methods to solve the noise problem in NISQ era quantum computer and reduce the compliation overhead in quantum computer. I am also interested in outreach and education in software and system level quantum computing. I have organizing the Quantum Computer System Lecture Series (QuCS) with my friend Hanrui Wang.

Schedule (Jun. 18 2:00-6:00 PM)

Time Topic Speaker
2:00-2:10 Opening Remarks Prof. Song Han (MIT)
2:10-2:45 Introduction to Quantum Computing Prof. Yongshan Ding (Yale)
2:45-4:00 Introduction to TorchQuantum and gate-level optimization of quantum circuits with TorchQuantum
Hands-on experiments of using TQ on gate level for training variational circuits and simulating algorithm circuits
Hanrui Wang (MIT)
4:00-4:30 Compress variational quantum circuit with TorchQuantum Prof. Weiwen Jiang (GMU)
4:30-5:00 Introduction to TorchQuantum pulse support and Pulse Level Optimizations Zhiding Liang (Notre Dame)
5:00-5:30 Hands-on Experiments of Using TQ on pulse level for variational circuit and optimal control Jinglei cheng (Purdue)
5:30-6:00 Different quantum gradient estimation methods and implementations in TorchQuantum Dantong Li (Yale)


This tutorial will be held at the 50th International Symposium on Computer Architecture (ISCA 2023). Check the ISCA2023 site for more information.

Event Location

Orlando World Center Marriott

8701 World Center Dr Orlando, FL 32821

Organizer and Contact

Hanrui Wang (