
Show HN: Hardware-agnostic library for near-term quantum machine learning - infinitewalk
https://github.com/XanaduAI/pennylane
======
infinitewalk
I'm one of the developers on PennyLane, a cross-platform Python library for
quantum machine learning (QML), automatic differentiation, and optimization of
hybrid quantum-classical computations.

For a while now, QML has been getting a _lot_ of hype --- at the
Quantum2Business conference the other day, a quote that made the rounds was
"QML: most overhyped and underestimated field at the same time" (attributed to
Iordanis Kerenidis, I believe).

However, current research has been showing a lot of promise, especially as an
application for near-term quantum devices, that doesn't require an
exceptionally large number of fault tolerant qubits.

At the moment, the main approach to QML has been the so-called 'variational
circuit' approach, where a parameterised quantum circuit is evaluated on
quantum hardware, with optimization/machine learning then performed by an
external classical ML library, such as TensorFlow/PyTorch. However, this is
not the most optimal approach - the most optimal approach is to take advantage
of the quantum hardware to also perform the optimization.

This was our goal with PennyLane. Before we could even start designing the
library, we needed to know how to analytically evaluate gradients on quantum
circuits; so we performed the research, discovered some cool analytic tricks,
and published this separately [1]. This forms the backbone of PennyLane - the
exact same quantum circuits used in the machine learning model are also used
to calculate the gradient during backpropagation. As a result, you can
construct arbitrarily complex classical-quantum models, with both the quantum
and classical parts natively 'backpropagation aware'.

Even more ambitiously, we wanted an environment where you can build a hybrid
classical-quantum computational model, using not only different quantum
hardware devices at once, but different hardware devices _from different
hardware vendors_. By taking advantage of _all_ near-term quantum hardware
currently available - even those using fundamentally different models, such as
qubits vs. photonic modes - you can build significantly more powerful
computations. Currently, we have plugins available for
[ProjectQ]([https://projectq.ch](https://projectq.ch)), [Strawberry
Fields]([https://github.com/XanaduAI/strawberryfields](https://github.com/XanaduAI/strawberryfields)),
[Qiskit]([https://qiskit.org/](https://qiskit.org/)), and more to come.

Feel free to ask any questions you might have on PennyLane, the state of QML,
and quantum computation in general!

[1] Evaluating analytic gradients on quantum hardware
([https://arxiv.org/abs/1811.11184](https://arxiv.org/abs/1811.11184))

[2] Check out the PennyLane documentation for the nitty-gritty on our analytic
gradient approach to QML:
[https://pennylane.readthedocs.io](https://pennylane.readthedocs.io)

~~~
p1esk
Is there any actual QC hardware that can run these algorithms? Does it even
make sense to say that you can "run" code on a quantum computer?

I don't follow this field much, but I remember there was a company called
D-Wave, and people saying their product was not a "real" quantum computer. Has
anything changed since?

~~~
infinitewalk
Actually, yes! ML algorithms using PennyLane have been run on the IBM Q
Experience, using both our Qiskit plugin
([https://github.com/carstenblank/pennylane-
qiskit](https://github.com/carstenblank/pennylane-qiskit)) and our ProjectQ
plugin ([https://github.com/xanaduai/pennylane-
projectq](https://github.com/xanaduai/pennylane-projectq)).

I can't say much more at the moment, but we should have a few more plugins
released in the next few weeks that targets hardware from other QC vendors.

The D-Wave question in an interesting one, though. Unlike the QC hardware
available from IBM, Rigetti, Google, etc, which uses a universal circuit
model, D-Wave has focused on a particular application - quantum annealing.
While our theoretical quantum gradient results only apply to the qubit model,
it is an interesting question whether they can be extended to the quantum
annealing framework.

~~~
p1esk
I looked at the intro page for Pennylane project, and it went completely over
my head. I'm a ML person, can you tell me how can quantum computation help me,
or why would I want to consider it? For example, would I be able to train my
neural networks faster on a quantum computer? What's the point?

