Algorithms General Technology Machine Learning Quantum Machine Learning Quantum Research

Quantum Machine Learning making it to Primetime with new Qiskit release 0.25

April 18, 2021

We covered the recent release of Qiskit 0.25 which is one of the most popular Quantum toolsets and languages. Supported by IBM, the framework has an established following, and therefore when there are major changes to the framework, you could say the zeitgeist changes. That major change amongst a few others is the inclusion of a dedicated Quantum Machine Learning Module.

What is Quantum Machine Learning?

There is no doubt that Machine Learning has been one of the hottest terms of the previous decades. Comprising everything from deep learning to smart NLP (Natural Language Processing) systems that aim to provide intelligence on our devices. So much of ML (Machine Learning) has entered common parlance. You’re likely already familiar with the process of taking a training data-set and using it to “train” a model which can then make predictions on data it has not seen before. The benefits of ML are that with the right algorithm researchers never need to worry about how the model actually works – they let the algorithms find the most optimal parameters that give the best results (or predictions).

Researchers have pushed the limits of Deep Learning – with often massive networks of nodes also driving machine resources to the limit – one of the rationales towards finding more optimal ways to build learning systems. Researchers from CQC (Cambridge Quantum Computing) are one of the leading developers of Quantum NLP, which aims to utilise Quantum Computers for Natural Language Processing. Many of us will agree that NLP has the potential to be revolutionary in the way we operate and utilise computing – whether that is voice recognition or “understanding” text. Likely you’ve interacted with some form on NLP on your travels around the WWW (World Wide Web). Bob Coecke is one of the leaders in the QNLP field and he heads up with the research team at CQC (as Chief Scientist), whilst finding time to be a professor of Computer Science at Oxford University.

As Quantum Computing grows in interest, one would expect that more interest grows in the intersection of Quantum and Machine Learning. Like the moniker says, QML (Quantum Machine Learning), uses Quantum in the mix, but what does it actually mean?

Perhaps the most general definition of QML is the “Combination of Quantum Algorithms with Machine Learning Algorithms”. Just as there a plethora of Machine Learning Algorithms there are plenty of Quantum Algorithms. You may have heard of some of the algorithms or techniques in Machine Learning such as: Neural Networks, Decision Trees, Support vector, Cosine Similarity, Regression and more. Some of the algorithms in Quantum are Grover and Shor. At the heart of QML is the ability to hybridise classical and quantum worlds. To jump right into the deep-end with an example, researchers have shown how they can build a hybrid Quantum Neural Network which exhibits the benefit of employing qubits to help learn patterns more effectively. Algorithms don’t have to be complex, and there are some Quantum versions of well known classical algorithms such as cosine similarity.

QML is a new and emerging area – rapidly moving as it blends two fast moving areas of development. Therefore don’t be surprised if new developments emerge continuously as researchers find new ways to explore Quantum and Machine Learning together, especially as the power of Quantum Computers continuously expands and develops.

Some of the challenges of using Quantum in ML are finding ways to translate data from the classical to quantum world. That challenge might sound trivial, but just as our representation of say the Arabic number system is converted to binary so computers can works with those numbers, data must be converted into a Quantum representation. Converting information into the Quantum world is not trivial and there are multiple ways to do it – in addition to it adding a high potential overhead or cost to the process – such a cost that there may be little or no benefit of employing Quantum representations or algorithms to solve a problem.

Despite all the potential pitfalls there are Quantum based algorithms and techniques which has been shown to offer a real advantage over pure classical techniques. A paper from 2020 has explored using QML and whether it can offer real speed-up. This publicationA rigorous and robust quantum speed-up in supervised machine learning” and a later publication on Quantum Classical offer an open invitation for the scientistic and engineering community to explore QML.

Qiskit + Machine Learning

Qiskit is a popular Quantum toolset and has been the under-pinnings of IBM’s move into the quantum space. That said it is an open-source implementation that is technically not hardware specific, much as many operating systems can run on different hardware. Whilst IBM back the Qiskit project, it Qiskit rather independently of IBM but is supported by IBM. Up unto this point, Qiskit has not offered a specific Machine Learning module, but that has not stopped scientists using Qiskit as the platform for building QML applications. But now, Qiskit has launched a whole new module update in their 0.25 version which includes a dedicated module for Machine Learning.

Qiskit is not the only kid on the block when it comes to Quantum Machine Learning. Companies such as Xanadu have been actively developing their QML offering named PennyLane for a number of years – which the aim of taking away much of the pain of working with often two different frameworks and paradigms (Quantum and Classical). Google has also a Quantum version of TensorFlow (TensorFlow Quantum) in its arsenal of products which can stated as a “library for rapid prototyping of hybrid quantum-classical ML models“. Developers will also be pleased that they can port their knowledge of the TensorFlow framework into the quantum domain.

Could Quantum Machine Learning usher in a new robotic age? Qiskit now includes a dedicated Machine Learning Module to make QML easier.
Could Quantum Machine Learning usher in a new robotic age? Qiskit now includes a dedicated Machine Learning Module to make QML easier.

In essence the key functionality required (for learning) is that quantum circuits can be parameterised. That means that any toolset must be able to effectively parametrise in the Quantum domain, otherwise the quantum aspect can offer no advantage. One of the keys to be able to determine parameters is the ability to differentiate quantum circuits – much as the Neural Network algorithms need to have an activation function which can be differentiable in order to find the lowest cost landscape.

The new module Qiskit Machine Learning includes fundamental components such as Quantum Kernels and Quantum Neural Networks. These components can be used to perform functions such as regression and classification for example. According to Qiskit, the drive behind the module is that it can allow users without a huge amount of quantum experience to utilise the power of Quantum Computing. The developers have aimed to make using the new module as seamless as possible and flexible enough that it can be used right the way from people wanting to do preliminary exploration to those wanting to do QML research. For those who want to integrate with the popular machine learning framework backed by Facebook, PyTorch can be integrated with Qiskit and the Machine Learning module. Gradients computed by PyTorch during back-propagation can take into account quantum neural networks, which makes integrating classical and quantum domains mach easier.

One of the core ML tasks is to map data into higher dimensional space to make solving that problem easier, such as classifying data. For example it might be possible to use a linear classifier if the data can transformed. Such a process is often named as the Kernel tick, enabling a linear classier to classify non linear data. Support Vector Machines are well known in the classical sense and there is a Quantum flavour which appears to offer advantages over classical setups. In Qiskit there are classes named QuantumKernel, Quantum Support Vector Classifier (QSVC), Quantum Support Vector Regressor (QSVR) that can directly be employed as their name suggests to perform classification or regression.

Many machine learning models rely on feature maps and their corresponding kernels to improve performance. The idea is to map given data into a higher-dimensional feature space where the problem at hand becomes easier to solve. Quantum computers offer the possibility to map data into exponentially higher-dimensional feature spaces and to efficiently evaluate the corresponding quantum kernels. It even has been shown that there exist problems that a Support Vector Machine (SVM) equipped with a Quantum Kernel can solve efficiently, while classically it is not possible to do better than random guessing.

Feature maps also find applications in certain quantum neural network (QNN) architectures to load input data onto a quantum computer, which has the potential to lead to more powerful models than those available classically. Note that this technique avoids some of the issues discussed above regarding data loading on quantum computers.

Qiskit Machine Learning. TwoLayerQNN, OpflowQNN and CircuitQNN. SVN and QNN.

Many researchers will of course be excited by the Quantum Neural Network capabilities. Qiskit provides a number of implementations such as TwoLayerQNN, OpflowQNN and CircuitQNN. Under the hood Qiskit needs to be able to parameterise quantum circuits. Two algorithms such as NeuralNetworkClassifier and NeuralNetworkRegressor do as you would expect and allow a circuit to be tuned to perform classification or regression. Qiskit have aimed for a universal interface to drive the neural network capability.

Learn more about Qiskit and Qiskit Machine Learning Module.