Quantum machine learning is one of the promising application domains of quantum computing, which is expected to improve and accelerate the most resource-intensive machine learning calculations. This talk will explain how we implement quantum machine learning algorithms, what are the limits and challenges, and how these challenges can be addressed.
3. Universal Quantum Computer
Architecture of the quantum computer
Quantum Processor
Analog instructions
Microarchitecture
Runtime
Transpiler
Compiler
Programming language
Algorithm
Problem representation Mathematical
model
Software
code
Firmware
Hardware
(quantum)
1 qubit can represent simultaneously 2 bits
2 qubits can represent 4 bits or 2^2
10 qubits can represent 2^10 bits or 128 bytes
30 qubits can represent 2^30 bits or 128 MB
40 qubits can represent 2^40 bits or 128 GB
50 qubits can represent 2^50 bits or 128 TB
…
1. Exploit superposition to keep more information
in quantum states
2. Exploit entanglement to parallelize operations
on these quantum states
3. Evolve the overall state to get expected results
4. Measure multiple times to get the probability
distribution of these results
Bit flip
Phase flip
Hadamard
CNOT
Toffoli
Meaasurement
Quantum gates Design of a quantum algorithm
Quantum circuit
Qubits
Classical bits
(results)
Initialization
Classical
computer
5. • Linear regression has been implemented using QPE and HHL
• Ridge regression, where QPE and QFT help find optimal value of the reg. parameter
• Perceptron can be implemented with Grover's search
• Support Vector Machine has been implemented with HHL algorithm
• k-means clustering and k-nearest neighbours classification can be improved with Grover's search
• Principal component analysis has been implemented with QPE and VQA
• Autoencoders have been implemented with VQA
• Restricted Boltzmann Machines have been implemented as Var-QBM
• Deep neural networks can be implemented as hybrid models with VQA
• GANs training has been done in a way that Generator or Discriminator use associative QBM-based NNs
• Synthetic data has been generated with QCBM
• Model-based RL can be enhanced with Grover's algorithm to find rewarding action-sequences
• RL Q-learning has been successfully tested with QBM, which generates values of the Q-value function
• Monte-Carlo sampling, implemented with QAE, can be used for policy evaluation in RL
Quantum Algorithms :
• QPE – Quantum Phase Estimation
• QAE – Quantum Amplitude Estimation
• QFT – Quantum Fourier Transform
• HHL - Harrow-Hassidim-Lloyd
• Grover’s search
• VQA/E – Variational Quantum Algorithm / Eigensolver
• QAOA – Quantum Approximate Optimization Algorithm
• QCBM – Quantum Circuit Born Machine
• QBM – Quantum Boltzmann Machines
Quantum-enhanced Machine Learning
Error-free NISQ
QPE ✓
QAE ✓
QFT ✓
HHL ✓
Grover’s ✓
VQA/E ✓
QAOA ✓
QCBM ✓
QBM ✓
6. Data Encoding
Basis
𝑥 = 0.1, −0.8, 1.0
First, convert to binary numbers
(up to a precision, lets’ say 𝜏=5)
𝑥 = 00011, 11001, 11111
Add a sign bit (0 for +, 1 for -):
𝑥 = 000011, 111001, 011111
Our state can be written as :
| ⟩
𝜓 = | ⟩
000011111001011111
Next, initialize qubits and use bit
flip to create this state.
Advantage: Easy to create
Disadvantage: Requires
𝜏+1*(#𝑥) qubits
Not suitable for NISQ computers
Amplitude
𝑥 = 0.1, −0.8, 1.0
First, normalize it :
𝑥 = 0.12 + −0.82 +12= 1.2845
𝑥 =
0.1
1.2845
,
−0.8
1.2845
,
1
1.2845
Pad it to log2(#𝑥) elements:
𝑥 = 0.078, −0.623, 0.779, 0
Our state can be written as :
| ⟩
𝜓 = 0.078| ⟩
00 - 0.623| ⟩
01 + 0.779| ⟩
10 + 0| ⟩
11
Next, make a custom operator to create this state.
Advantage: Uses log2N qubits to encode N features
Disadvantage: Depth of encoding circuit
Not suitable for NISQ computers
Angle
𝑥 = 0.1, −0.8, 1.0
Rescale the data to 0-2𝜋 radians:
𝑥 = 3.45575, 0.62832, 6.28319
Use X rotation for each data point:
⟩
|𝜓1 = 𝑅𝑥(3.45575)
⟩
|𝜓2 = 𝑅𝑥(0.62832)
⟩
|𝜓3 = 𝑅𝑥 6.28319
Advantage: Can be used for NISQ
Higher-order Angle
Repeat angle encoding circuit multiple times
This can encode complex frequencies, as the
frequency spectrum increases linearly with
the number of repetitions
Intertwine encoding with data processing
In Qiskit implemented with PauliFeatureMap
and ZZFeatureMap as rotation around Z axis
7. QML Training Process
Training procedure :
1. Data Encoding
• Basis
• Amplitude
• Angle
2. Variational Circuit
• Expressive power
3. Measurements (readouts)
4. Cost Function
5. Analytic Gradient Descent
6. Update parameters
7. Run again until convergence
- Parameter shift rule and Linear combination
- Natural gradient
• Higher entangling capability means being better able to capture non-trivial
correlations in the input data
• Expressivity increases with stacking up several layers
Labels extraction :
• based on parity or
• measuring only the first qubit
Beware of the barren plateau !
How to implement non-linearity ?
• QFT
• repeat-until-success schemes
• Use stochastic nature of measurement
8. QML – Neural Networks
Source: S. Mangini et al 2021 EPL 134 1000
9. QML - Kernel Methods
Quantum Kernels - SVM
Feature maps help resolve the data non-linearity problem
Dual formulation reduces the dimensions of the search space through
a function that implicitly encodes the feature map
But to ensure quantum
speedup, the quantum
kernel function Φ(𝑥) has
to be hard to estimate
clasically.
Idea: Design quantum
kernels to exploit the
group structure in data.
Example is DLOG kernel
Sources:
Global Qiskit Summer School 2021
https://arxiv.org/pdf/2010.02174.pdf
10. QML – Coding Examples
• Building hybrid quantum-classical classifier
• Hybrid quantum-classical neural network for MNIST recognition
• 6
• Quantum Support Vector Machine
https://github.com/LZRVC/Quantum-Computing
11. Your next steps
https://www.meetup.com/Quantum-Serbia
https://www.linkedin.com/groups/9024908/
email: quantumserbia@gmail.com
https://qiskit.org/advocates/
Join :
Learn :
From Books
• Qiskit Textbook (https://qiskit.org/textbook) by IBM
• Quantum Computation and Quantum Information by
M. Nielson, I.Chuang
• Quantum Programming Illustrated by Aleksandar Radovanovic
• Introduction to Quantum Information Science by Vlatko Vedral
• Quantum Computing for Computer Scientists by N. Yanofski
• Machine Learning with Quantum Computers by Maria Schuld
Online Courses
• CaltechX, DelftX (2018) Quantum Cryptography (edX, online)
• Keio (2018) Understanding Quantum Computers (futurelearn.com)
IBM Qiskit Summer Schools (in July, online)
• TUDelft (2021) The Hardware of a Quantum Computer (edX, online)