Teaching Quantum Computing with Q#
This post is part of the Q# Advent Calendar 2019. Check out the calendar for more great posts!
This winter our team had an exciting opportunity to teach an introductory course on quantum computing at the University of Washington, led by Krysta Svore. It was a special experience for all of us, but especially for me, since I’ve never been involved in the university education process in any role other than a student.
If you prefer watching videos to reading, here are the videos from Microsoft Faculty Summit 2019, where Martin Roetteler and I talk about our experience teaching this course: part 1 and part 2.
First of all we had to figure out what we are going to cover in the course and how to teach it. Quantum computing is a huge field, and can be taught from a variety of different angles, from quantum physics and the physical realization of quantum computers to pure quantum information theory. What to choose?
We decided to approach the subject from a computer scientist’s point of view, focusing on programming and solving practical problems. Indeed, a typical course in classical computing starts by introducing a programming language and teaching the students to use it to solve simple tasks; then it covers basic algorithms and data structures, with homework assignments centered around implementing the data structures and using the algorithms to solve more complicated tasks; finally, the students have a choice of courses on more advanced topics (again with practical applications), capstone projects etc. You don’t often see a classical software engineer who would be trained in transistor physics and computational complexity theory but who only ever implemented algorithms on paper!
We ended up creating a course leaning heavily towards the practical implementation of quantum algorithms; it included both written assignments and programming assignments, with the latter accounting for a larger share of the final grade than the former, and a final programming project instead of a more customary written exam or a presentation-style project.
Learning Quantum Programming with Q#
Our main tool for teaching the students quantum programming were the Quantum Katas. I’ve mentioned them before once or twice, so I won’t go into great detail on them again – I’ll just note that they are as good for classroom learning as they are for self-paced. In addition, they did a really good job of preparing the students for their homework.
Programming assignments were structured exactly like the katas (that was before we introduced the Jupyter Notebooks, so all programming materials were Q# projects): the students would get a file with task descriptions and the skeleton operations for them, and they’d have to fill in the code that solves the tasks. Here, for example, is the first task from week 4 of the course, in which we covered quantum oracles:
The neatest thing about the programming assignments was that they were graded automatically. (I’ve never been in a TA’s shoes myself, but I can certainly sympathize with the need to grade over 30 assignments!) Similarly to the katas, each task of the assignment was covered by a test, and if the test passed, the solution was judged correct.
In week 6 of the course we tried a different flavor of a programming assignment: the students had to do resource estimation for Shor’s algorithm implemented in our samples. These tools would come handy for them later in the course.
The last programming assignment was even more unusual for quantum computing courses than the previous ones: the students were to take part in the Q# Coding Contest, which was conveniently held during the last month of the course. Programming courses on algorithms or machine learning sometimes use a similar approach, offering problems from Kaggle, Codeforces or other online judges as assignments or even hosting small programming competitions for the students.
However exciting hosting the contest was for us, the students didn’t take it well. A lot of topics in the contest were covered in the course, but the contest tasks were much harder than the homework assignments. Add the extra pressure from the timed nature of the competition and the requirement to participate in it alone, and the results were disappointing: only one student solved all problems.
The final projects were small capstones for the course: the students would form teams of 2-3 people and work on a quantum computing problem of their choice, going through all the steps from choosing and defining the problem to solving it and implementing the solution in Q# to describing the solution in a mini-paper and presenting it to the class.
This was the favorite part of the course for a lot of students. On the one hand, it allowed them to focus on any topic they were excited about and to deep-dive into it. On the other hand, it was extremely practical: the students had a chance to actually experiment with their algorithms of choice, figure out how much resources are required to run them and how to construct a small instance of a problem that can be solved on a simulator, optimize their solutions and compare different implementations — in other words, do a lot of things that comprise a quantum software engineer’s day work!
The last two lectures of the course were dedicated to the final projects presentations. This was when I got to finally meet the students in person (before that I focused on behind-the-scenes parts of the course, so the students knew me only as a disembodied online presence). The range of projects done by the students was quite impressive — from entanglement games and key distribution protocols to quantum chemistry and a Bitcoin mining algorithm!
The course has completed over half a year ago, but it had more lasting outcomes than just a pass/fail grade for the students who took it.
First, several teams chose to frame their final projects as new katas and to contribute them back to the Quantum Katas project for the next generation of learners to use.
Second, several students went on to do internships at companies who work on quantum computing (well, most of those were on our team, but that still counts!) and quite possibly will make a career in it.
Finally, we learned a lot about the best ways to teach people quantum computing. We really hope to teach a new, updated and improved version of this course soon! Meanwhile, we are happy to share our materials and learnings with other instructors looking to teach quantum computing from a practical point of view (if you’re interested, contact me at email@example.com).
Hi @Mariia I really enjoy reading your blog posts. You along with the quantum team at Microsoft including Megan, Alen, Bettina are doing a phenomenal job. Being a beginner in this field, I can understand how difficult it is for you guys to create the Katas,explaining such difficult topics in a lucid and simplified manner. I would like to get in touch with you as well as the team, however don’t know which one of the social platforms would be the best. Is there any slack channel or email address to be in touch with the team?