Never Miss a Post. Subscribe!
  • Michał Stęchły

How to start your first quantum computing project

Updated: Aug 9, 2019

Dear Reader!


I regularly get emails like this:

“Hi! I’m interested in quantum computing. I’ve done some tutorials and implemented basic algorithms (e.g. Grover’s). Now I would like to do a more advanced project but I don’t know how to start and cannot decide what would be the right topic. Could you help me with that?”


If you can identify with this—you’re in a good place. I decided to write a blog post describing how to do a project like this by yourself. Some parts are universal and apply to any project, others are “quantum-specific”. 


If you’re interested in seeing what projects I have done myself, you can find some of them on the projects page.


As usually, QC stands for “Quantum Computing".


0. Motivation


As always, you should start with „Why?”. What do you want to achieve? The most common motivations I see are:

- I want to learn QC

- I want to build up my portfolio

- I’m curious how QC can apply to my field.


So before you start, make sure you know what you want to achieve - it will help make you right decisions along the way.


1. Prerequisites

This is a list of minimum requirements that I consider necessary to do a successful QC project. I don’t think the bar to start is very high, but if you lack any of these, you should probably focus on working to improve them.


Coding

Well, since I assume you want to do a software project, you need to know how to code. The default language for most frameworks is Python. It’s advisable to learn it, but if you don’t know it, don’t worry—you can start with other languages too; here are examples of projects written in:

- Javascript

- C

- Julia

- C# (It's actually Q#, but that's pretty similar, right?)


It might be obvious, but the better coder you are, the easier it will be for you to focus on the problem you want to solve and not get distracted by coding issues. So if you have just started to learn to code, it might be good to spend some time honing your skills first.


QC basics

Before you start doing a QC project, you need to know some basics. You need to know what gates are, what they are doing, how the superposition works etc.

Until recently I would say one of the best ways to learn it is by going through the tutorials and documentation of pyQuil and/or qiskit. But recently I started reading Quantum computing for the very curious by Andy Matuschak and Michael Nielsen and it's the best intro to quantum computing I've ever seen.


Don’t bother with understanding all the details—it’s not an easy topic and some ideas simply need time. Just learn enough to feel comfortable with the terminology and get a basic intuition of how it works. And I think “basic” is a crucial word here—if you don’t understand something, you can always come back to it later.


Linear algebra

From the mathematical point of view, quantum computing is mostly linear algebra. Regular 1st-year algebra should suffice—being familiar with vectors, matrices, eigenvalues, etc. Tensors also come in handy, but you can learn more about them as you go.

I recommend not only having calculation skills but also some intuition as to what it’s all about— there is no better place on the Internet to get a feel for that than 3Blue1Brown YouTube channel.


Git

Technically you can do a project without using git, but technically you can also chop a carrot with a spoon instead of a knife. But why would you do that? If you’ve never used git, learn the basics and start using its basic features. Believe me—it will pay off in the future.


Determination and humility

Keep in mind that doing a simple QC project is not like doing, let’s say, a simple machine learning project. There are not that many resources on the web (beyond the basics), software packages are at a very early stage, and we (QC community) have not yet invented an easy way of explaining how it all works. 


Especially if you’re inexperienced, this probably won’t be a project you can do over a weekend.


Also, I believe it requires some dose of humility to acknowledge that you don’t understand everything you’re doing. Personally, I don’t fully understand all the theory behind the algorithms I use on a daily basis and don’t have perfect intuition. I don’t feel particularly well about it and constantly strive to learn more, but it doesn’t stop me from doing impactful projects right now.


Machine Learning and Optimization (optional)

While I don’t think it’s necessary, working knowledge of ML and optimization methods are extremely useful in many projects you might want to do, especially those using variational algorithms. 

It requires a similar skill set and gives you the right kind of intuition.

If you have no idea about ML, the classic Andrew Ng course will give you all the basics you need to know. And if you have more time, I highly recommend doing fast.ai courses.

Recently I've also skimmed through this course on optimization - pretty good way to start if you've never done any optimization (check out this video to pay a reasonable price ;) ).


Quantum computing overview (optional)

What I mean by „overview” here is the general knowledge about the trends and the industry. While not technically required, it gives you a better idea of what’s realistic, what might be worth investigating and where the field is heading. 

Some resources that might help you get a bigger picture: 

- quantum computing report

- YouTube playlist of my favorite QC videos

- Fact Based Insight

- Following right people from the field on Twitter



Keep in mind there is a lot of hype and misinformation about QC in the popular press, so not everything that you read is necessarily true or valuable! The ability to filter information will come with time and number of people in the industry you talked to.


Quantum mechanics (NOT!)

Well, I strongly believe you don’t need to understand much of quantum mechanics to start playing with quantum computing. Sure, you need that to achieve mastery, but for now, we are not talking about mastery, but about getting started.

A couple of basics that you might want to learn about:

- Double slit experiment

- Basic postulates of quantum mechanics

- What a Hamiltonian represents


2. Project phases


Below are some of the phases that most projects I’ve done (or have been involved in) went through. This is not a strict and definite list, but I hope it will give you some ideas on what these projects might look like.

They are:

- Exploration

- Preparation

- Implementation

- Review

- Promotion


Exploration

Goals

- Find out what interest you

- Assess the necessary  skills

Actions:

- Explore other projects

- Go through some tutorials

- Read some papers


In this phase, you should explore different paths. Read, watch, tinker. You should get a clearer picture of what would make a fun project for you and what you still need to learn in order to succeed.

When it comes to reading papers - I know it’s not an easy task, it requires experience and perseverance. If you don’t have experience, this video might help. Also, remember that you don’t need to be alone in this - do seek help from more experienced folks if you need!


Preparation

Goals:

- Make sure you have the necessary skills

- Acquire the necessary knowledge

- Create a plan


Actions:

- Online courses

- Tutorials

- Papers

- Pen & paper


Before you dive deep into the project, it’s good to get some background and make sure you know what you’re doing. I’ve seen people trying to do a very ambitious project which was simply too difficult for them. It’s much better to assess the situation, make sure you know the basics, etc. For example, if you want to implement a quantum machine learning (QML) algorithm, but have never done a machine learning project, perhaps it’s good to start from this, or take an online course (see my recommendations earlier).


When it comes to choosing a right QC framework, they are pretty similar, so just choose make sure the one you like has the basics features needed for your project implemented (e.g. VQE or QAOA).


It’s also important to create a plan — even if a very rough one at first. See what’s needed to succeed, what the right tools are, etc. 


Keep in mind one of the best pieces of advice I’ve ever got:

“Weeks of coding can save you hours of planning”.

Though don't take this one literally ;)


Implementation

Goals

- Do the project ;)


Actions

- Code

- Put the code on Github

- Ask for help

- Document & clean


This is the “core” part and varies a lot from project to project. However, there are a couple of things worth remembering:

- I strongly recommend putting your code on GitHub. Publicly and from the outset. It won’t hurt and there are many benefits. My favorite benefit is that by making your code public, you have a stronger motivation to actually write good code ;)

- You will be stuck many, many times. QC is not web development and you simply might not be able to find answers to your questions on Stack Overflow (though Quantum SO might come in handy). Look for people and communities that might help and ask for help.

- Your project might be useful for other people, including a future you. Do all of them a favor: write proper documentation and don’t leave spaghetti code behind :) 

- Be realistic with the timeframes! As in every software project, you should estimate how much time it will take and multiply it by 3. And don’t be too hard on yourself, since it is probably something you will be doing in the evenings and weekends. It is more important to do regular progress and keep going rather than finish it quickly.


You might think “I have an interesting, well-documented project on my GitHub. I’m done!”

Well, you might be. But I recommend going two steps further.


Review

Goals

- Get feedback

Actions:

- Write to people who might be interested

- Show it to friends


If you’ve implemented a paper, write to the authors and show them your work. If you’ve used some tools, let the people who created them know. They would love to hear their creations has been used!


Ask your friends for feedback. Even if they have nothing to do with QC, they still might comment on some other aspects of your project. It might turn out you forgot about some simple but important things, which are crucial for the last phase—promotion.


Promote

Goals

- Get some fame and recognition ;)

Actions:

- Promote

- Write a blogpost

- Write a tutorial


Let others know what you have done. Promote it on social media, QC groups and Slack channels. Consider writing a blogpost and putting it on Medium or creating a tutorial out of it, so it’s easier for others to do what you did.

You might consider putting your project on the list at QOSF or applying for the Unitary Fund to expand your project.

Fame and recognition is one thing, but actually there might be other people out there, who want to do similar thing. Make it easier for them to build on top of what you've done.



3. Project types


Here, I would like to expand on what I consider a “QC project.” Some of these are better suited for experienced software engineers, some for academics and others for beginners. Treat this list as an inspiration. The order is random.


Start from scratch

I’ve never done it myself, but some people recommend it as a good starting point. Try writing your own QC simulator using your favorite language. Even though it’s probably not very practical—existing simulators will be much better—it’s still a good way to learn. After creating such simulator, you will definitely have linear algebra and basics of quantum computation covered, and you will probably be aware of the challenges involved.

If you are not sure how to start, you can check out this project .


Implement an algorithm from a paper and reproduce the results.

Unfortunately, if you get above introductory level, there are not many sources of knowledge. The most common one (and probably the hardest to digest) are papers.

It’s not the easiest thing to do, but sometimes it’s much easier than one might suspect (sometimes also much harder ;) ). It depends on the paper and your skills.

Also, reproducibility of the results is (or should be) the core of scientific progress. So by showing that you can get the same results as the authors of the paper, you validate their work. 

Here are some papers and their implementations:

- Variational Quantum Factoring: paper, my implementation

- Quantum Kitchen Sinks: paper, Zack Gow's implementation

- Artificial quantum neuron: paper, Collin Farquhar's implementation

- Quantum circuit learning: paper, Dawid Kopczyk's implementation


Adapt existing method

You don’t need to implement an algorithm from scratch. You can take an existing method and code and apply to a new problem. QAOA gives a lot of possibilities to do that, as shown in the Stuart Hadfield's thesis.

Or you can take a QML algorithm and try how well it works on other datasets.


Research

You can create an algorithm or use an existing one and do some research. In this case, the focus won’t be on the implementation itself, but rather on exploring how introducing changes influences the results. Try changing the parameters, running it with and without noise, compile it to different architectures—there are many possibilities.


Contribute

As I stated in my previous blog post, you can simply contribute to other repositories. There is probably no better way to learn how a given library works than to fix or modify it. This also has the benefit of being easy to divide into smaller chunks, so if you don’t have much time for a project, this might be a good starting point.


Tools

Quantum algorithms sound cool, but unfortunately, even the best engineer won’t be able to get work done without proper tools.

If you have an idea for a useful tool (e.g. how to improve debugging or visualization), I guarantee many people will be grateful for that.


Port

In my opinion, one of the easiest things to do is to simply port an algorithm. It’s a good way to learn how it works and to learn a new library. Also, you don’t have to invent anything new, so there shouldn’t be that many hurdles on your way.

Some examples of such ports:

- Port of pyQuils QAOA to CirQ and ProjectQ

- Quantum Kitchen Sinks from pyQuil to Qiskit (both implementation here)



4. Project ideas

Here are some ideas for the projects. Some of them are easy to realize, some are more difficult, some might even not be good ideas ;) 


There is one thing most people don’t realize in the beginning, but which might be pretty important when it comes to your goals. There is a huge difference between “ideal” quantum computing and “NISQ” quantum computing. This article describes it in more details, but in general you either: 

- assume you have an ideal quantum computer - there are no errors, your programs can be as long as you wish and all the qubits are connected to each other.

- try to make use of the very imperfect machines that we have today (so called NISQ), and have to take all of their limitations into account.


Personally, I think the latter is much more interesting, practical and impactful. If you have trouble identifying how to categorize given paper/project/idea – let me know, I will help :)

But anyway, if you would like to do a QC project and look for inspiration, check out the list below. They all fall into category of “NISQ projects”. My article about contributions might also give you some ideas.


- Use genetic algorithms for optimizing circuit compilation: example

- In general, there is a lot of space for improving how compilation is done, it’s an interesting research topic. See quilc and pyZX.

- Implement QAOA solving any of the problems proposed by Stuart Hadfield in his thesis. Actually, my tutorial on TSP might help with that.

- Do some more research based on existing projects (e.g.: ones we did at Bohr )

- Make a script for visualizing the energy levels of Hamiltonians.

- Play with visualizations for QAOA—you can easily get pretty interesting results (I touched it in my VQF project).

- Apply VQE for PCA (Principal Component Analysis).

- Conversion of quantum circuits between different platforms (see: https://github.com/perak/q-convert).

- Take any project using QAOA and try improving the results by implementing different optimization algorithms.


These descriptions are somewhat vague and I don't necessarily have a clear picture of how it should look like. So don’t try too hard to think what I had in mind—just get inspired :) 



Closing notes 

I hope now you have a clearer picture of how to start your own project. 

In the end, I would like to repeat the most important points:

- It won’t be easy, but it will be rewarding.

- Don’t do it alone—ask others for help.


As always—I’m happy to hear your opinion on this topic and if this blogpost helped—let me know at michal.stechly@gmail.com. If you think this post might help someone else - please share :)


And if you don't want to miss the upcoming posts, please subscribe to the newsletter!


Have a nice day!

Michał