Teaching Quantum Computing Using Microsoft Quantum Development Kit and Azure Quantum
Teaching Quantum Computing Using Microsoft Quantum Development Kit and Azure Quantum
Abstract—This report describes my experience teaching a that traditional approaches to teaching quantum computing,
arXiv:2311.12960v2 [physics.ed-ph] 15 Dec 2023
graduate-level quantum computing course at Northeastern Uni- focused either on the mathematical presentation of the field or
versity in the academic year 2022–23. The course takes a on the theoretical physics of quantum systems and hardware
practical, software-driven approach to the course, teaching basic
quantum concepts and algorithms through hands-on program- devices, would be inefficient.
ming assignments and a software-focused final project. The The course approached the subject of quantum computing
course guides learners through all stages of the quantum software from a computer science point of view, similar to [4]. It
development process, from solving quantum computing problems focused on teaching basic concepts and algorithms of quantum
and implementing solutions to debugging quantum programs,
computing in a practical manner, requiring students to apply
optimizing the code, and running the code on quantum hardware.
This report offers instructors who want to adopt a similar prac- their theoretical knowledge to solving problems, write the
tical approach to teaching quantum computing a comprehensive quantum code to implement the solutions, and verify its
guide to getting started. correctness using quantum simulators or explore its behavior
when executed on quantum hardware.
I. I NTRODUCTION
The course covered a combination of introductory topics
Quantum computing represents a novel approach to com- featured in most courses and textbooks on quantum computing
puting, utilizing quantum-mechanical phenomena like super- with deeper dives into the topics important for understanding
position and entanglement to execute certain computational the current landscape and the future directions of quantum
tasks more efficiently compared to classical computing. The computing. It consisted of 10 week-long lecture modules (the
increasing interest and financial support in the field of quantum number selected to match the length of the semester), an
information science and engineering (QISE) have resulted in introductory module covering the required software setup and
a growing need for quantum-trained workforce. the math prerequisites (linear algebra tutorial), and a final
Recent evaluations of the needs of quantum industry[1][2] project. The lecture modules were, in order of presentation:
identified quantum software engineering and application devel-
1) Single-qubit quantum systems: the concept of a quantum
opment as one of the competencies essential for certain roles
state, superposition, single-qubit gates, measurements.
within the sector. Surveys of the university programs offer-
2) Multi-qubit quantum systems: multi-qubit quantum states,
ing Master-level education in QISE[2][3] show that quantum
entanglement, multi-qubit gates, measurements of multi-
programming is often incorporated in them as an independent
qubit systems (including partial measurements).
course or as a component within an introductory course.
3) Simple communication algorithms: BB84 quantum key
In this report I describe my experience teaching a graduate
distribution algorithm, teleportation, superdense coding.
course “CSYE6305: Introduction to Quantum Computing with
4) Quantum phase oracles and simple oracular algorithms:
Applications” at Northeastern University during the fall and
Deutsch, Deutsch-Josza, and Bernstein-Vazirani.
spring semesters of the academic year 2022–23. I outline
5) Reversible computing: reversible Boolean logic, re-
the guiding principles behind the course design, describe the
versible circuit synthesis, implementing marking oracles.
programming assignments created for the course, and discuss
6) Grover’s search algorithm and using it to solve problems.
the lessons learned.
7) Quantum software stack.
I hope that this work will inspire more instructors to adopt
8) Building up to Shor’s algorithm: Fourier transform, phase
a similar software-driven approach to delivering quantum
estimation, Shor’s algorithm for integer factorization.
computing courses and enable a broader student audience to
9) Quantum error correction and fault-tolerant quantum
learn quantum programming.
computing.
II. C URRICULUM AND COURSE STRUCTURE 10) The current landscape of quantum hardware development
The course targets engineering graduate students who do not and the quantum community.
specialize in quantum information science and do not necessar- Each of the lecture modules included a 3-hour lecture that
ily have an extensive background in physics, mathematics, or introduced the relevant concepts, explained quantum algo-
theoretical computer science. The students’ background means rithms, and covered the software tools necessary for complet-
©2023 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including
reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or
reuse of any copyrighted component of this work in other works.
ing the module’s assignments. The supplementary materials
for the modules included recommended and optional reading
material, and tutorials and katas from the open-source project
Quantum Katas [5] for hands-on problem solving and pro-
gramming practice.
Student performance was evaluated in two ways:
• weekly programming assignments (60% of the final Fig. 1. State preparation task that asks the student to replace the “// ...”
comment with Q# code that prepares the qubit in the described state
grade), and
• the final project (40% of the final grade in fall 2022, up
to 65% of the final grade in spring 2023). results produced by the students’ code matched the expected
Weekly programming assignments were offered in the ones. The testing harnesses relied on the use of quantum
introductory module and the first six lecture modules, up simulators and program validation tools available in the QDK,
to and including module 6 (“Grover’s search algorithm”). described in more detail in [7]. Examples of the tasks that were
Most modules included multiple types of assignments; for offered in automatically graded assignments included:
example, module 1 (“Single-qubit quantum systems”) included • preparing the described quantum state,
automatically graded programming assignments on single- • performing the measurements to identify the quantum
qubit quantum systems and a hardware exploration assignment state of the given qubits,
in which students explored running a quantum random bit • implementing the required unitary transformation, for ex-
generator on a cloud simulator and on a quantum device. ample, a quantum oracle implementing the given classical
The final project was introduced after module 7 (“Quantum function, and others.
software stack”). Students worked on it during the last month
of the course and presented their work at the last meeting. This approach enabled the automation of the grading pro-
The course was taught using Q#[6], a high-level domain- cess, significantly reducing the workload on the instructor.
specific quantum programming language, and the Microsoft Additionally, sharing the testing harnesses with the students
Quantum Development Kit (QDK)1 , an open-source software as part of the assignment allowed them to receive feedback
development kit that includes a Q# compiler, a variety of on their solutions before submitting them for grading.
quantum simulators, and other tools for quantum software Figure 1 shows an example of a task that asks the student to
design and development. The assignments that required run- prepare a quantum state 0.8|0⟩−0.6|1⟩. The corresponding Q#
ning quantum programs on quantum hardware used Azure operation takes one input parameter - the qubit in the |0⟩ state
Quantum2 , a cloud service that provides access to quantum - and does not produce an output. Since it should prepare a
hardware and simulators from different companies. The use quantum state, it acts by changing the state of the qubit passed
of Azure Quantum in the course was covered by the Azure to it as the argument rather than by producing an output.
Quantum Credits program3 and was free for the students, The testing harness for this task used a state vector simulator
which allowed them to experiment with running their programs (the full state simulator or the sparse simulator included in
on the hardware without worrying about the costs. the QDK4 ). It applied the student’s solution to a qubit in the
|0⟩ state, followed by applying the adjoint of the “reference”
III. AUTOMATICALLY GRADED QUANTUM PROGRAMMING solution - the instructor’s solution known to be correct. If the
PROBLEMS student’s solution prepared the expected state, this sequence of
Most of the assignments in the course required students to steps resulted in the qubit returning to the |0⟩ state; otherwise,
apply the theory they learned in the module to solve small, the qubit would end up in a different state. The state of the
practical programming problems related to the topic. The tasks qubit at the end of the test execution was validated using built-
in these assignments followed the structure of the problems in QDK tools [7].
in the Quantum Katas[5]. Each task described a specific
IV. D EBUGGING QUANTUM PROGRAMS
quantum computing problem and provided the signature of a
Q# operation that needed to be implemented to solve the given Assignments that require the students to identify and fix the
problem. Students then had to fill the body of the operation issues in the given quantum programs aim to enhance both
with the code that implemented the solution. their proficiency with the programming tools employed in the
Similar to the problems in the Quantum Katas, programming course and their understanding of the algorithms studied in it.
assignments of this type supported automatic grading and We can distinguish three types of errors found in programs
student self-evaluation. Automatic grading was implemented (both classical and quantum) based on the ways they manifest.
using predefined testing harnesses for the tasks - Q# projects Syntax errors Errors in the syntax of the program that pre-
that ran the solutions on a set of tests and validated that the vent the code from being recognized by the compiler or
1 https://learn.microsoft.com/azure/quantum/overview-what-is-qsharp-and- the interpreter. Since Q# is a compiled language, syntax
qdk errors are typically detected at compile-time or even
2 https://learn.microsoft.com/azure/quantum/overview-azure-quantum
3 https://learn.microsoft.com/azure/quantum/azure-quantum-credits 4 https://learn.microsoft.com/azure/quantum/machines/
Q U A N T M
Fig. 2. Debugging task that shows the output of the BB84 protocol with
a logical error (incorrect gate used to change the basis of the qubit on the Fig. 3. Circuit optimization task that asks the student to rewrite the circuit
sender side) to minimize the resources required to run it. The control bit sequences of the
gates spell the alphabet positions of letters QUANTM (the top wire is the
least significant bit of the letter number).
sophisticated implementation that coverts the problem the search space compared to the first one, thus reducing
definition into a matching oracle programmatically. the number of Grover iterations used. On the other
3) Test the solution, i.e., write the unit tests to check that the hand, it increases the complexity of state preparation and
quantum oracle implemented in the solution is correct. reflection about the mean. The resources required for
4) Compare simulation speeds of the full state simulator and different implementations can be evaluated and compared
the sparse simulator available in the QDK when used to using Azure Quantum Resource Estimator service.
solve the same instances of the problem. 6) Run the solution for a small problem instance on one of
5) Compare different solution approaches and the resources the Azure Quantum hardware targets, and compare the
they require. For example, consider the problem of color- results with the results produced by noiseless simulation.
ing the vertices of an N -vertex graph using three colors 7) Use quantum counting to estimate the number of problem
so that each pair of vertices connected by an edge is solutions. Outside of this task, the students could use a
colored in different colors. One approach is to define the classical estimation of the number of solutions to get the
search space of all bit strings of length 2N that represent optimal number of iterations to be used, or implement
coloring N vertices with colors 00, 01, 10, and 11, and their solution without knowing the number of solutions.
use an oracle that checks both that the pairs of connected 8) Explore automatic code generation for the same problem
vertices have distinct colors and that none of the vertices with Classiq platform5 . The platform offered examples of
are colored 11. Another approach limits the search space code generation for Grover’s search algorithm that could
to only bit strings that represent coloring N vertices with be modified to implement the students’ projects.
colors 00, 01, and 10 by changing the state preparation 9) Present the results during the last lecture of the course.
and reflection about the mean parts of the algorithm, and This encouraged students to practice their public speaking
uses an oracle that only checks that the pairs of connected skills, get early feedback on their work, and learn more
vertices have distinct colors. about the topics covered from other students’ work.
Different approaches to problem solutions can have vary-
The complete solution to the problem and the final presen-
ing resource requirements. In the described example,
tation were required for all final projects. The rest of the tasks
the second approach reduces both the number of qubits
required for the oracle implementation and the size of
5 https://platform.classiq.io/
were optional, and each students could select a subset of the circuit to the point where the results of running it on quan-
tasks they wanted to focus on. tum hardware are noticeably more accurate, or to explore
The breakdown of the project into specific tasks enabled whether running Grover’s search for fewer iterations than
standardized grading across the different approaches the stu- the optimal iteration number would yield higher success
dents could’ve taken to solve and implement their problem of probability due to smaller circuit depth.
choice, since the variation of approaches within each task was Offer multiple choices of the hardware provider. Across
significantly smaller than that within the whole projects. the two sessions of the course, several assignments were
negatively impacted by temporary unavailability of one
VIII. L ESSONS LEARNED AND FUTURE WORK of the providers’ hardware targets. Enabling running
each assignment on multiple hardware backends and
Based on my observations teaching the course during the
allowing the students to choose the backend to use
academic year 2022–23, the performance of 10 students who
would mitigate the impact of such issues.
enrolled in one of the sessions during this period, and the
student feedback collected after the course I believe that the Finally, the artifacts created for these courses can be ac-
described software-oriented approach is an effective way to cessed by quantum computing educators worldwide to inspire
introduce students with software development and engineering them to adopt a similar teaching approach6 .
backgrounds to quantum computing. IX. ACKNOWLEDGEMENTS
The students enjoyed the hands-on assignments and sin- I thank Kal Bugrara who invited me to teach the course
gled out the Quantum Katas as the part of the course that “CSYE6305: Introduction to Quantum Computing with Ap-
contributed the most to their learning. Sharing the testing plications” at Northeastern University, and the College of En-
harnesses for the automatically graded programming assign- gineering at Northeastern University for enabling this course.
ments with the students led to higher success levels on these I am also grateful to my students for their valuable feedback.
assignments compared to the earlier course session (academic
year 2019–20), in which the students had to come up with R EFERENCES
ways to validate their solutions themselves. [1] C. Hughes, D. Finke, D.-A. German, C. Merzbacher, P. M. Vora, and
On the other hand, several students struggled with the tran- H. J. Lewandowski, “Assessing the needs of the quantum industry,”
2021. [Online]. Available: https://arxiv.org/abs/2109.03601
sition from the small guided assignments to the large project [2] C. D. Aiello, D. D. Awschalom, H. Bernien, T. Brower, K. R. Brown,
focused on self-driven problem solving and exploration. Of T. A. Brun, J. R. Caram, E. Chitambar, R. D. Felice, K. M. Edmonds,
the 10 students enrolled, 2 failed the course, and one passed M. F. J. Fox, S. Haas, A. W. Holleitner, E. R. Hudson, J. H. Hunt,
R. Joynt, S. Koziol, M. Larsen, H. J. Lewandowski, D. T. McClure,
it on the second attempt. The students who received failing J. Palsberg, G. Passante, K. L. Pudenz, C. J. K. Richardson, J. L.
grades did not engage with the learning materials, including Rosenberg, R. S. Ross, M. Saffman, M. Singh, D. W. Steuerman,
the weekly assignments, beyond the first weeks of the course. C. Stark, J. Thijssen, A. N. Vamivakas, J. D. Whitfield, and B. M.
Zwickl, “Achieving a quantum smart workforce,” Quantum Science and
Multiple students expressed special appreciation for the Technology, vol. 6, no. 3, p. 030501, jun 2021. [Online]. Available:
horizon-broadening nature of the course, and claimed that this https://doi.org/10.1088/2058-9565/abfa64
course was among the best ones they have taken as part of [3] T. Plunkett, T. L. Frantz, H. Khatri, P. Rajendran, and S. Midha, “A
survey of educational efforts to accelerate a growing quantum workforce,”
their coursework. One of the students even mentioned that in 2020 IEEE International Conference on Quantum Computing and
they were interested in pursing quantum computing in their Engineering (QCE), 2020, pp. 330–336.
further graduate studies. [4] M. Mykhailova and K. M. Svore, Teaching Quantum Computing through
a Practical Software-Driven Approach: Experience Report. New York,
In the future offerings of this course, the homework assign- NY, USA: Association for Computing Machinery, 2020, p. 1019–1025.
ments would benefit from the following improvements. [Online]. Available: https://doi.org/10.1145/3328778.3366952
[5] Quantum Katas: programming exercises for learning Q# and
Offer more advanced debugging assignments. Pure Q# quantum computing. [Online]. Available: https://github.com/microsoft/
syntax errors turned out to be very easy to identify and QuantumKatas/
fix. At the same time, weekly assignments did not offer [6] K. Svore, A. Geller, M. Troyer, J. Azariah, C. Granade, B. Heim,
V. Kliuchnikov, M. Mykhailova, A. Paz, and M. Roetteler, “Q#: Enabling
students enough practice identifying and eliminating scalable quantum computing and development with a high-level DSL,”
more sophisticated issues, such as the program containing in Proceedings of the Real World Domain Specific Languages Workshop
elements that are not supported on certain hardware 2018, ser. RWDSL2018. New York, NY, USA: ACM, 2018, pp. 7:1–
7:10. [Online]. Available: http://doi.acm.org/10.1145/3183895.3183901
providers in Azure Quantum, that surfaced during their [7] M. Mykhailova and M. Soeken, “Testing quantum programs using Q#
work on their final projects. and Microsoft Quantum Development Kit,” in Quantum Software and
Diversify hardware exploration assignments. The most ef- Engineering Workshop, 2021. [Online]. Available: http://ceur-ws.org/
Vol-3008/short6.pdf
fective hardware exploration assignments were the ones [8] M. E. Beverland, P. Murali, M. Troyer, K. M. Svore, T. Hoefler,
that went beyond the mere observation of the existence V. Kliuchnikov, G. H. Low, M. Soeken, A. Sundaram, and A. Vaschillo,
of the noise, to exploring the impact of the noise on “Assessing requirements to scale to practical quantum advantage,” 2022.
the feasibility of running end-to-end algorithms on the
near-term quantum devices. It would be interesting, for
example, to combine hardware exploration with circuit
optimization, asking the students to optimize the given 6 https://github.com/microsoft/quantum-curriculum-preview