Skip to content

Commit

Permalink
[docs] Concepts, design, and overview updates (tensorflow#124)
Browse files Browse the repository at this point in the history
* Copy design to concepts. Update book.

* Separate content for design and concepts guide

* Update concepts guide

* Update design guide

* Update overview and landing page

* feedback
  • Loading branch information
lamberta authored Feb 27, 2020
1 parent d6b1356 commit 6ab0fdf
Show file tree
Hide file tree
Showing 5 changed files with 213 additions and 128 deletions.
4 changes: 3 additions & 1 deletion docs/_book.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ upper_tabs:
path: /quantum/overview
- title: "Install"
path: /quantum/install
- title: "Design and concepts"
- title: "Quantum machine learning"
path: /quantum/concepts
- title: "TensorFlow Quantum design"
path: /quantum/design
- heading: Tutorials
- title: "Hello, many worlds"
Expand Down
33 changes: 20 additions & 13 deletions docs/_index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,26 @@ landing_page:
items:
- classname: devsite-landing-row-50
description: >
<p>TensorFlow Quantum (TFQ) is a Python framework for hybrid
quantum-classical machine learning. As an application framework, TFQ
allows quantum algorithm researchers and ML application researchers to
leverage Google’s quantum computing frameworks, all from within
TensorFlow.</p>
<p/>TensorFlow Quantum focuses on modeling quantum data. It provides
tools to interleave quantum algorithms and logic designed in
<a href="https://cirq.readthedocs.io/" class="external">Cirq</a>
with TensorFlow. A basic understanding of quantum computing is required
to effectively use TensorFlow Quantum.</p>
<p>To get started, read the <a href="./overview">overview</a> and
<a href="./design">design and concepts</a> guide, then run the
<a href="./tutorials/hello_many_worlds">tutorials</a>.</p>
<p>
TensorFlow Quantum (TFQ) is a
<a href='./concepts'>quantum machine learning</a> library for rapid
prototyping of hybrid quantum-classical ML models. Research in
quantum algorithms and applications can leverage Google’s quantum
computing frameworks, all from within TensorFlow.
</p>
<p>
TensorFlow Quantum focuses on <em>quantum data</em> and building
<em>hybrid quantum-classical models</em>. It integrates quantum computing
algorithms and logic designed in
<a href="https://github.com/quantumlib/Cirq" class="external">Cirq</a>,
and provides
quantum computing primitives compatible with existing TensorFlow APIs,
along with high-performance quantum circuit simulators.
</p>
<p>
Start with the <a href="./overview">overview</a>, then run the
<a href="./tutorials/hello_many_worlds">notebook tutorials</a>.
</p>
code_block: |
<pre class = "prettyprint">
Expand Down
132 changes: 132 additions & 0 deletions docs/concepts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Quantum machine learning concepts

Google's
<a href="https://ai.googleblog.com/2019/10/quantum-supremacy-using-programmable.html" class="external">quantum supremacy experiment</a>
used 53&nbsp;*noisy*&nbsp;qubits to demonstrate it could perform a calculation
in 200 seconds on a quantum computer that would take 10,000 years on the largest
classical computer using existing algorithms. This marks the beginning of the
<a href="https://quantum-journal.org/papers/q-2018-08-06-79/" class="external">Noisy Intermediate-Scale Quantum</a>&nbsp;(NISQ)
computing era. In the coming years, quantum devices with tens-to-hundreds of
noisy qubits are expected to become a reality.

## Quantum computing

Quantum computing relies on properties of quantum mechanics to compute problems
that would be out of reach for classical computers. A quantum computer uses
*qubits*. Qubits are like regular bits in a computer, but with the added ability
to be put into a *superposition* and share *entanglement* with one another.

Classical computers perform deterministic classical operations or can emulate
probabilistic processes using sampling methods. By harnessing superposition and
entanglement, quantum computers can perform quantum operations that are
difficult to emulate at scale with classical computers. Ideas for leveraging
NISQ quantum computing include optimization, quantum simulation, cryptography,
and machine learning.


## Quantum machine learning

*Quantum machine learning* (QML) is built on two concepts: *quantum data* and
*hybrid quantum-classical models*.

### Quantum data

*Quantum data* is any data source that occurs in a natural or artificial quantum
system. This can be data generated by a quantum computer, like the samples
gathered from the
<a href="https://www.nature.com/articles/s41586-019-1666-5" class="external">Sycamore processor</a>
for Google’s demonstration of quantum supremacy. Quantum data exhibits
superposition and entanglement, leading to joint probability distributions that
could require an exponential amount of classical computational resources to
represent or store. The quantum supremacy experiment showed it is possible to
sample from an extremely complex joint probability distribution of 2^53 Hilbert
space.

The quantum data generated by NISQ processors are noisy and typically entangled
just before the measurement occurs. Heuristic machine learning techniques can
create models that maximize extraction of useful classical information from
noisy entangled data. The TensorFlow Quantum (TFQ) library provides primitives
to develop models that disentangle and generalize correlations in quantum
data—opening up opportunities to improve existing quantum algorithms or discover
new quantum algorithms.

The following are examples of quantum data that can be generated or simulated on
a quantum device:

- *Chemical simulation* —Extract information about chemical structures and
dynamics with potential applications to material science, computational
chemistry, computational biology, and drug discovery.
- *Quantum matter simulation* —Model and design high temperature
superconductivity or other exotic states of matter which exhibits many-body
quantum effects.
- *Quantum control* —Hybrid quantum-classical models can be variationally
trained to perform optimal open or closed-loop control, calibration, and error
mitigation. This includes error detection and correction strategies for
quantum devices and quantum processors.
- *Quantum communication networks* —Use machine learning to discriminate among
non-orthogonal quantum states, with application to design and construction of
structured quantum repeaters, quantum receivers, and purification units.
- *Quantum metrology* —Quantum-enhanced high precision measurements such as
quantum sensing and quantum imaging are inherently done on probes that are
small-scale quantum devices and could be designed or improved by variational
quantum models.

### Hybrid quantum-classical models

A quantum model can represent and generalize data with a quantum mechanical
origin. Because near-term quantum processors are still fairly small and noisy,
quantum models cannot generalize quantum data using quantum processors alone.
NISQ processors must work in concert with classical co-processors to become
effective. Since TensorFlow already supports heterogeneous computing across
CPUs, GPUs, and TPUs, it is used as the base platform to experiment with hybrid
quantum-classical algorithms.

A *quantum neural network* (QNN) is used to describe a parameterized quantum
computational model that is best executed on a quantum computer. This term is
often interchangeable with *parameterized quantum circuit* (PQC).


## Research

During the NISQ-era, quantum algorithms with known speedups over classical
algorithms—like
<a href="https://arxiv.org/abs/quant-ph/9508027" class="external">Shor's factoring algorithm</a> or
<a href="https://arxiv.org/abs/quant-ph/9605043" class="external">Grover's search algorithm</a>—are
not yet possible at a meaningful scale.

A goal of TensorFlow Quantum is to help discover algorithms for the NISQ-era,
with particular interest in:

1. *Use classical machine learning to enhance NISQ algorithms.* The hope is that
techniques from classical machine learning can enhance our understanding of
quantum computing. In
<a href="https://arxiv.org/abs/1907.05415" class="external">meta-learning for quantum neural networks via classical recurrent neural networks</a>,
a recurrent neural network (RNN) is used to discover that optimization of
the control parameters for algorithms like the QAOA and VQE are more efficient
than simple off the shelf optimizers. And
<a href="https://www.nature.com/articles/s41534-019-0141-3" class="external">machine learning for quantum control</a>
uses reinforcement learning to help mitigate errors and produce higher
quality quantum gates.
2. *Model quantum data with quantum circuits.* Classically modeling quantum data
is possible if you have an exact description of the datasource—but sometimes
this isn’t possible. To solve this problem, you can try modeling on the
quantum computer itself and measure/observe the important statistics.
<a href="https://www.nature.com/articles/s41567-019-0648-8" class="external">Quantum convolutional neural networks</a>
shows a quantum circuit designed with a structure analogous to a
convolutional neural network (CNN) to detect different topological phases of
matter. The quantum computer holds the data and the model. The classical
processor sees only measurement samples from the model output and never the
data itself. In
<a href="https://arxiv.org/abs/1711.07500" class="external">Robust entanglement renormalization on a noisy quantum computer</a>,
the authors learn to compress information about quantum many-body systems
using a DMERA model.

Other areas of interest in quantum machine learning include:

* Modeling purely classical data on quantum computers.
* Quantum-inspired classical algorithms.
* <a href="https://arxiv.org/abs/1810.03787" class="external">Supervised learning with quantum classifiers</a>.
* Adaptive layer-wise learning for quantum neural network.
* <a href="https://arxiv.org/abs/1909.12264" class="external">Quantum dynamics learning</a>.
* <a href="https://arxiv.org/abs/1910.02071" class="external">Generative modeling of mixed quantum states</a> .
* <a href="https://arxiv.org/abs/1802.06002" class="external">Classification with quantum neural networks on near term processors</a>.
129 changes: 39 additions & 90 deletions docs/design.md
Original file line number Diff line number Diff line change
@@ -1,83 +1,33 @@
# TensorFlow Quantum design and concepts

In October 2019,
<a href="https://www.blog.google/perspectives/sundar-pichai/what-our-quantum-computing-milestone-means/" class="external">Google announced</a>
they achieved
<a href="https://www.nature.com/articles/s41586-019-1666-5" class="external">quantum supremacy</a>.
Using 53&nbsp;*noisy*&nbsp;qubits, this demonstration was a critical first step to unlock
the full potential of quantum computing and marks the beginning of the
<a href="https://quantum-journal.org/papers/q-2018-08-06-79/" class="external">Noisy Intermediate-Scale Quantum</a>&nbsp;(NISQ)
computing era. In the coming years, quantum devices with tens-to-hundreds of
noisy qubits are expected to become a reality. So what is possible with these
devices?

There are many ideas for leveraging NISQ quantum computing including
optimization, quantum simulation, cryptography, and machine learning.
TensorFlow&nbsp;Quantum&nbsp;(TFQ) is designed to help researchers experiment
with these ideas. Researchers create and run *quantum circuits*. It integrates
with TensorFlow, an established machine learning framework used for research and
production. TensorFlow Quantum provides flexible and performant tools and
constructs used by quantum machine learning researchers. TensorFlow Quantum
hopes to bridge the quantum and classical machine learning communities—and
enrich both with new perspectives and ideas.

## NISQ quantum machine learning

During the NISQ-era, quantum algorithms with known speedups over classical
algorithms—like
<a href="https://arxiv.org/abs/quant-ph/9508027" class="external">Shor's factoring algorithm</a> or
<a href="https://arxiv.org/abs/quant-ph/9605043" class="external">Grover's search algorithm</a>—are
not yet possible at a meaningful scale.

A goal of TensorFlow Quantum is to help discover algorithms for the
NISQ-era, with particular interest in:

1. *Use classical machine learning to enhance NISQ algorithms.* The hope is that
techniques from classical machine learning can enhance our understanding of
quantum computing. For example,
<a href="https://arxiv.org/abs/1907.05415" class="external">this paper</a>
shows a recurrent neural network (RNN) used to discover that optimization of
the control parameters for algorithms like the QAOA and VQE are more efficient
than simple off the shelf optimizers. And
<a href="https://www.nature.com/articles/s41534-019-0141-3" class="external">this paper</a>
uses reinforcement learning to help mitigate errors and produce higher
quality quantum gates.
2. *Model quantum data with quantum circuits.* Classically modeling quantum data
is possible if you have an exact description of the datasource—but sometimes
this isn’t possible. To solve this problem, you can try modeling on the
quantum computer itself and measure/observe the important statistics.
<a href="https://www.nature.com/articles/s41567-019-0648-8" class="external">This paper</a>
shows a quantum circuit designed with a structure analogous to a
convolutional neural network (CNN) to detect different topological phases of
matter. The quantum computer holds the data and the model. The classical
processor sees only measurement samples from the model output and never the
data itself. In
<a href="https://arxiv.org/pdf/1711.07500.pdf" class="external">this paper</a>
the authors learn to compress information about quantum many-body systems
using a DMERA model.

Other areas of interest in quantum machine learning include:

1. Modeling purely classical data on quantum computers.
2. Quantum-inspired classical algorithms. TFQ does not contain any purely
classical algorithms that are quantum-inspired.

While these last two areas did not inform the design of TensorFlow Quantum,
you can still use TFQ for research here. For example, in
<a href="https://arxiv.org/abs/1802.06002" class="external">this paper</a>
the authors use a quantum computer to solve some purely classical data problems—
which could be implemented in TFQ.


## Software components

TensorFlow Quantum is designed for the problems of NISQ-era quantum machine
learning. Integration with [TensorFlow](https://www.tensorflow.org/overview) and
[Keras](https://www.tensorflow.org/guide/keras/overview) is seamless and
performant. And the `tfq.datasets` module allows researchers to experiment and
converse about new and interesting quantum datasets.

### Primitives
# TensorFlow Quantum design

TensorFlow Quantum (TFQ) is designed for the problems of NISQ-era quantum
machine learning. It brings quantum computing primitives—like building quantum
circuits—to the TensorFlow ecosystem. Models and operations built with
TensorFlow use these primitives to create powerful quantum-classical hybrid
systems.

Using TFQ, researchers can construct a TensorFlow graph using a quantum dataset,
a quantum model, and classical control parameters. These are all represented as
tensors in a single computational graph. The outcome of quantum
measurements—leading to classical probabilistic events—is obtained by TensorFlow
ops. Training is done with the standard
[Keras](https://www.tensorflow.org/guide/keras/overview) API. The `tfq.datasets`
module allows researchers to experiment with new and interesting quantum
datasets.


## Cirq

<a href="https://github.com/quantumlib/Cirq" class="external">Cirq</a> is a
quantum programming framework from Google. It provides all of the basic
operations—such as qubits, gates, circuits, and measurement—to create, modify
and invoke quantum circuits on a quantum computer, or a simulated quantum
computer. TensorFlow Quantum uses these Cirq primitives to extend TensorFlow for
batch computation, model building, and gradient computation. To be effective
with TensorFlow Quantum, it’s a good idea to be effective with Cirq.


## TensorFlow Quantum primitives

TensorFlow Quantum implements the components needed to integrate TensorFlow with
quantum computing hardware. To that end, TFQ introduces two datatype primitives:
Expand All @@ -91,9 +41,6 @@ quantum computing hardware. To that end, TFQ introduces two datatype primitives:
operators defined in Cirq (`cirq.PauliSum`). Like circuits, create batches of
operators of varying size.

With these primitives, TFQ can build the functionality to merge quantum
computing with TensorFlow.

### Fundamental ops

Using the quantum circuit primitives within a `tf.Tensor`, TensorFlow Quantum
Expand Down Expand Up @@ -122,12 +69,14 @@ challenges:

For performance reasons, Eigen (the C++ library used in many TensorFlow ops) is
not well suited for quantum circuit simulation. Instead, the circuit simulators
used in the quantum supremacy experiment were used as verifiers and extended for
the foundation of TFQ ops (all written with AVX2 and SSE instructions). Ops with
identical functional signatures were created that use a physical quantum
computer. Switching between a simulated and physical quantum computer is as easy
as changing a single line of code. These ops are located in the
`circuit_execution_ops.py` in `tensorflow_quantum/core/ops/`.
used in the
<a href="https://ai.googleblog.com/2019/10/quantum-supremacy-using-programmable.html" class="external">quantum supremacy experiment</a>
are used as verifiers and extended as the foundation of TFQ ops (all written
with AVX2 and SSE instructions). Ops with identical functional signatures were
created that use a physical quantum computer. Switching between a simulated and
physical quantum computer is as easy as changing a single line of code. These
ops are located in the
<a href="https://github.com/tensorflow/quantum/blob/master/tensorflow_quantum/core/ops/circuit_execution_ops.py" class="external"><code>circuit_execution_ops.py</code></a>.

### Layers

Expand Down Expand Up @@ -162,7 +111,7 @@ sampling or state vector calculation, use `tf.custom_gradient`.

### Datasets

As the field of quantum computing grows, more and more quantum data and model
As the field of quantum computing grows, more quantum data and model
combinations will arise, making structured comparison more difficult. The
`tfq.datasets` module is used as the data source for quantum machine learning
tasks. It ensures structured comparisons for the model and performance.
Expand Down
Loading

0 comments on commit 6ab0fdf

Please sign in to comment.