Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf ·...

27
Quantum neurons Yudong Cao with Gian Giacomo Guerreschi, Alán Aspuru-Guzik Quantum Techniques in Machine Learning 2017, Verona, Italy.

Transcript of Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf ·...

Page 1: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

Quantum neuronsYudong Caowith Gian Giacomo Guerreschi, Alán Aspuru-Guzik

Quantum Techniques in Machine Learning 2017, Verona, Italy.

Page 2: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

The quest for quantum neural nets

• Parametrized quantum system that can be trained to accomplish tasks such as classification

• In many cases, it is not easy to identify what is the fundamental building block with which one could describe the quantum system as a learning algorithm

• This work can be seen as a conceptual attempt at addressing this issue

Page 3: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

Nonlinear and parallel

Builds up its own rules through experience

Neural network

a machine that is designed to mimic the way in which the brain performs a particular task or function of interest

Page 4: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

Basic requirements for quantum NN

1. Initial state encodes any N-bit binary string

2. Reflects one or more basic neural computing mechanisms

3. The evolution is based on quantum effects

e.g. attractor dynamics, synaptic connections, integrate & fire, training rules, structure of a NN

01001 01001

Schuld, M., Sinayskiy, I. & Petruccione, F. Quantum Inf Process (2014) 13: 2567

Superposition and entanglement

Page 5: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

(artificial) Neuron

𝜃

𝜃 = 𝑖𝑤𝑖𝑥𝑖 + 𝑏

𝑏0

1

𝜃

𝜎 𝜃

Page 6: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

Can we realize artificial neurons on a quantum computer?

Page 7: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

QM + NN: an unlikely match ?

• Unitary evolution

• Rotation in Hilbert space

Quantum Mechanics (QM) Neural Networks (NN)

• Lossy transformations

• Clustering, classification, compression etc

Page 8: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

Challenges

• Sigmoid / step function activationHow to realize on quantum computers, whose dynamics is linear?

• Measurement? Open system?May collapse the state / reduce to classical probabilistic algorithms

Dissipative dynamics

Story of quantum error correction

Reversible circuits

Cost scaling?

Page 9: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

Our proposal

Neuron Qubit

Activation Rotation angle

rest active

Activation 𝑦 = 𝜎(𝜃) 0rest

active 1

𝑅𝑦(𝜑) 0

𝜑

𝜃 = 𝑖𝑤𝑖𝑥𝑖 + 𝑏

𝑥1

𝑥2

𝑥𝑛

𝑤1

𝑤2

𝑤𝑛

0

1

𝜃

𝜎 𝜃

Information from previous layer

𝜑 = 𝛾𝜃 +𝜋

4

Page 10: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

Introduce nonlinearity

Repeat-until-success (RUS) circuits:

Given ability to realize 𝑅𝑦 2𝑥

One could use RUS to realize 𝑅𝑦(2𝑓(𝑥))

𝑓 𝑥 = arctan tan2 𝑥

𝑥

Measure 0: 𝑅𝑦(𝑓(𝑥)) 𝜓

Measure 1: 𝑅𝑦(𝜋/4) 𝜓

Success

Fail but easily correctable

Nonlinear!

Repeat until success

𝑅𝑦 𝜃 =cos

𝜃

2−sin

𝜃

2

sin𝜃

2cos

𝜃

2

Page 11: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

𝑓 𝑓 …𝑓 𝑥 … = 𝑓°𝑘(𝑥)

𝑘 times

𝑅𝑦 𝑥 𝑅𝑦 𝑓(𝑥 ) 𝑅𝑦 𝑓°𝑘(𝑥)……

Page 12: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

0

0

𝑅𝑦(2𝑓(𝜃)) 0

0

1 𝑅𝑦(𝑓∘𝑘(𝜃)) 0𝑅𝑦(ߠ) 0

𝜃

Prev. layer |010…>

RUS x k

Controlled rotations by angle 𝑤𝑖, 𝑏

𝑥1 = 0

𝑥2 = 1

𝑥3 = 0

Close to either 0 or 1 due to nonlinear

function 𝑓

Weighted sum

Nonlinear output

𝜃 = 𝑖𝑤𝑖𝑥𝑖 + 𝑏

𝑥1

𝑥2

𝑥3

𝑤1

𝑤2

𝑤3

𝜃 = 𝑖𝑤𝑖𝑥𝑖 + 𝑏

𝑦 = 𝜎(𝜃)

Prev. layer

Weighted sum

Nonlinear output

Page 13: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

• Size

• Neuron type

• Connectivity

• Activation function

• Weight/bias setting

• Training method

• …

Page 14: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained
Page 15: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

Feedforward network

“cat”

Page 16: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

XOR network

𝑥1

𝑥2

Train the network such that 𝑠 = 𝑥1⨁𝑥2

𝑠

1

2

00 1 + 01 0

+ 10 0 + 11 1

𝒙𝟏 𝒙𝟏 𝒔

0 0 1

0 1 0

1 0 0

1 1 1

Input

Correct output

𝑍𝑍 Accuracy: 1+ 𝑍𝑍

2

Page 17: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

1

2

00 1 + 01 0

+ 10 0 + 11 1

Solid: training on

Dashed: testing on

00 10 01 11

average

Page 18: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained
Page 19: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

8-bit parity network

𝑥1

𝑥2

Train the network such that 𝑠 = 𝑥1⨁…⨁𝑥8

𝑠

𝑍𝑍

Accuracy: 1+ 𝑍𝑍

2

𝑥3

𝑥4

𝑥5

𝑥6

𝑥7

𝑥8

⋮8

Page 20: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

1

28

𝑖=0

28−1

𝑖 Parity(𝑖)

Solid: training on

Dashed: testing on 28=256 states 00000000 00000001

⋯ 11111111

average

Page 21: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained
Page 22: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

Hopfield network

Initial state

Update Repeat

Final state (attractor)

𝑠𝑖

𝑠𝑖 = 1 𝜃𝑖 > 0−1 𝜃𝑖 < 0

𝑠𝑗

𝑤𝑖𝑗

𝜃𝑖 = 𝑗≠𝑖

𝑤𝑖𝑗𝑠𝑗 + 𝑏𝑖

Page 23: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

Hopfield net of quantum neurons𝑠1

𝑠𝑖 = 1 𝜃𝑖 > 0−1 𝜃𝑖 < 0

𝜃𝑖 = 𝑗≠𝑖

𝑤𝑖𝑗𝑠𝑗 + 𝑏𝑖

𝑠2

𝑠3 𝑠4

𝑞1(0)

𝑞2(0)

𝑞3(0)

𝑞4(0)

𝑞3(1)

RUS x k

𝑞4(2)

RUS x k

𝑞2(3)

RUS x k

𝑛 + 𝑡 + 𝑘 qubits for Hopfield network of 𝑛 neurons and 𝑡 updates

Page 24: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

Numerical exampleattractors: letters C and Y3x3 grid

0

1

+ + +1

1 1

0 0

0

initial input after 1 update

after 2 updates after 3 updates

Page 25: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

Summary

• Building block for quantum neural network satisfying• Initial state encoding n-bit strings

Neuron <-> Qubit

• One or more neural computing mechanisms

Sigmoid/step function, attractor

• Evolution based on quantum effects

Train with superposition of examples

• Application and extensions• Superposition of weights (networks) ?

• Different forms of networks

• Different activation functions

Page 26: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

Acknowledgements

Gian Giacomo Guerreschi

Alán Aspuru-Guzik

Postdocs

Peter JohnsonJonathan Olson

Graduate students

Jhonathan Romero FontalvoHannah (Sukin) SimTim MenkeFlorian Hase

Page 27: Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf · The quest for quantum neural nets •Parametrized quantum system that can be trained

Thanks!