Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf ·...
Transcript of Quantum neurons - qtml2017.di.univr.itqtml2017.di.univr.it/resources/Slides/Quantum-Neuron.pdf ·...
Quantum neuronsYudong Caowith Gian Giacomo Guerreschi, Alán Aspuru-Guzik
Quantum Techniques in Machine Learning 2017, Verona, Italy.
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
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
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
(artificial) Neuron
𝜃
𝜃 = 𝑖𝑤𝑖𝑥𝑖 + 𝑏
𝑏0
1
𝜃
𝜎 𝜃
Can we realize artificial neurons on a quantum computer?
QM + NN: an unlikely match ?
• Unitary evolution
• Rotation in Hilbert space
Quantum Mechanics (QM) Neural Networks (NN)
• Lossy transformations
• Clustering, classification, compression etc
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?
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
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
𝑓 𝑓 …𝑓 𝑥 … = 𝑓°𝑘(𝑥)
𝑘 times
𝑅𝑦 𝑥 𝑅𝑦 𝑓(𝑥 ) 𝑅𝑦 𝑓°𝑘(𝑥)……
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
• Size
• Neuron type
• Connectivity
• Activation function
• Weight/bias setting
• Training method
• …
Feedforward network
“cat”
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
1
2
00 1 + 01 0
+ 10 0 + 11 1
Solid: training on
Dashed: testing on
00 10 01 11
average
8-bit parity network
𝑥1
𝑥2
Train the network such that 𝑠 = 𝑥1⨁…⨁𝑥8
𝑠
𝑍𝑍
Accuracy: 1+ 𝑍𝑍
2
𝑥3
𝑥4
𝑥5
𝑥6
𝑥7
𝑥8
⋮8
1
28
𝑖=0
28−1
𝑖 Parity(𝑖)
Solid: training on
Dashed: testing on 28=256 states 00000000 00000001
⋯ 11111111
average
Hopfield network
Initial state
Update Repeat
Final state (attractor)
𝑠𝑖
𝑠𝑖 = 1 𝜃𝑖 > 0−1 𝜃𝑖 < 0
𝑠𝑗
𝑤𝑖𝑗
𝜃𝑖 = 𝑗≠𝑖
𝑤𝑖𝑗𝑠𝑗 + 𝑏𝑖
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
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
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
Acknowledgements
Gian Giacomo Guerreschi
Alán Aspuru-Guzik
Postdocs
Peter JohnsonJonathan Olson
Graduate students
Jhonathan Romero FontalvoHannah (Sukin) SimTim MenkeFlorian Hase
Thanks!