0% found this document useful (0 votes)
6 views16 pages

Quantum Machine Learning

The document presents an overview of Quantum Machine Learning (QML), emphasizing the advantages of integrating quantum computing with machine learning techniques. It discusses the potential for exponential speed-ups in various tasks, such as inner-product estimation and solving linear systems, compared to classical methods. Additionally, it covers foundational concepts in quantum computing, data encoding strategies, and specific applications like Quantum Neural Networks and Quantum Support Vector Machines.

Uploaded by

avi dity
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views16 pages

Quantum Machine Learning

The document presents an overview of Quantum Machine Learning (QML), emphasizing the advantages of integrating quantum computing with machine learning techniques. It discusses the potential for exponential speed-ups in various tasks, such as inner-product estimation and solving linear systems, compared to classical methods. Additionally, it covers foundational concepts in quantum computing, data encoding strategies, and specific applications like Quantum Neural Networks and Quantum Support Vector Machines.

Uploaded by

avi dity
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Quantum Machine Learning

1. Title Slide
Title: Quantum Machine Learning

Subtitle: Merging Quantum Computing with AI

Your Name / Affiliation

Date

Slide 2: Motivation & Overview

Why Combine QC with ML?


1. Curse of Dimensionality in Classical ML
Classical algorithms often struggle as the number of features N grows, since
many operations (e.g.\ computing inner products, solving linear systems)
scale at least linearly or polynomially in N :

Classical cost = O(N


p
), p ≥ 1 

Quantum computers, by contrast, can represent an N-dimensional vector x =

(x0 , … , xN −1 )
​ ​
using only log2 N qubits via amplitude encoding:

N −1
∣x⟩ =
1

∥x∥
​ ∑
i=0
​ xi ∣i⟩,
​ 

packing exponentially many amplitudes into a polynomially sized register.

2. Exponential Feature Spaces


Many ML methods—from kernel machines to support-vector classifiers—
benefit from mapping input data into very high– or infinite–dimensional feature
spaces. Quantum circuits can naturally enact such maps in Hilbert space. For
example, a quantum kernel between two inputs x, yx, ycan be estimated as
2
2 N −1

1
K (x, y) = ⟨x∣y⟩
​ ​
≈ ​ ​ ∑ ​ xi y i
​ ​ ​

∥x∥∥y∥ i=0

in time scaling polynomially in log⁡N\log N, rather than NN itself.

3. Quantum Speed-Ups in Key Subroutines

Quantum Machine Learning 1


Linear algebra subroutines such as solving Ax = b via the HHL
algorithm can under certain conditions run in
O(log N )time(versusO(N ) or worse classically).

Sampling and optimization routines (e.g.\ preparing Gibbs states,


amplitude amplification) can offer quadratic to exponential improvements
for particular distributions or search problems.

Potential for Exponential Speed-Ups


Classical Quantum
Task
Complexity Complexity

Inner-product estimation O(N )  O(log N ) 


1
Solving sparse linear systems (HHL) O(N κ)  O(log N κ )
2


Kernel evaluation in high-dimensional


O(N
2
)(naı̈ve)  O(poly(log N )) 
space

¹κis the condition number of the matrix; runtime assumes


sparsity and efficient state preparation.

Slide 3: Classical ML Primer

Supervised vs. Unsupervised vs. Reinforcement Learning


Supervised Learning
Learn a mapping f : X → Y from labeled examples {(xi , yi )};tasks include
​ ​

classification and regression.

Unsupervised Learning

Discover structure in unlabeled data {xi };tasks include clustering (e.g.\ k-


means), density estimation, dimensionality reduction (e.g.\ PCA).

Reinforcement Learning

Agent interacts with an environment, observing states st , taking actions at ,


​ ​

and receiving rewards rt ;goal is to learn a policy π(a∣s)that maximizes


Quantum Machine Learning 2


cumulative reward.

Key Building Blocks


1. Data Encoding

Feature extraction and normalization

Representing inputs in vector or tensor form

2. Model Training

Defining a loss or cost function L(θ)

Optimization (e.g.\ gradient descent) to find parameters θ ∗ =

arg minθ L(θ)





3. Inference

Using the trained model to predict or decide on new inputs

Complexity often scales with model size and input dimension

Classical Bottlenecks
Curse of Dimensionality

As feature dimension N grows, data becomes sparse; sample complexity and


runtime often scale as O(N )or worse.

Optimization Landscapes
Non-convex loss surfaces (e.g.\ deep neural nets) exhibit local minima, saddle
points, and plateaus, making training slow and sometimes unstable.

Slide 4: Quantum Computing Essentials

Qubits, Superposition, and Entanglement


Qubit State
A qubit lives in a two-dimensional Hilbert space with computational basis
{∣0⟩, ∣1⟩} . A general pure state is

Quantum Machine Learning 3


∣ψ⟩ = α ∣0⟩ + β ∣1⟩, ∣α∣
2
+ ∣β ∣
2
= 1. 

Superposition

Unlike a classical bit, a qubit can be in a coherent combination of


∣ ∣
0⟩\lvert0\rangle and 1⟩\lvert1\rangle, visualized as a point on the Bloch
sphere:

∣ψ⟩ = cos
θ

2
​ ∣0⟩ + e

sin
θ

2
​ ∣1⟩. 

Entanglement

Multi-qubit states can exhibit correlations with no classical analog. Example


Bell state for two qubits:

∣Φ
+
⟩ =
1

2


(∣00⟩ + ∣11⟩) ,

which cannot be factored into single-qubit states.

Quantum Gates & Circuits


Single-Qubit Gates

0 1
Pauli-X (bit-flip): X = ( ​ ) ​ 
1 0

1 1
Hadamard: H creates equal superpositions
1
= ​ ( ​ )

2 ​

1 −1

Multi-Qubit Gates

CNOT (controlled NOT) flips target iff control is ∣1⟩

Quantum Circuits
Gates are applied in sequence (and in parallel on different qubits) to build up
complex unitary transformations.

Circuit example (2 qubits):

∣0⟩—[H ]— ●—
│
∣0⟩———— ⊕ — 

Quantum Machine Learning 4


Creates a Bell state by Hadamard on qubit 1 then CNOT from qubit 1 to qubit 2.

Measurement and Collapse


Projective Measurement

Measuring in the {∣0⟩, ∣1⟩}basis yields outcome 0with probability α∣2 and 11
with probability ∣β ∣2 .

State Collapse

Post-measurement the qubit collapses to the observed basis state. Thus


quantum algorithms must be designed to extract useful statistics from many
repeated runs.

Slide 5: Data Encoding—From Classical to Quantum

Basis (Amplitude) Encoding


Goal: Encode an NNdimensional classical vector x = (x0 , … , xN −1 )
​ ​ into the
amplitudes of log2 N qubits. ​

State Preparation:
N −1
∣ψx ⟩ = ​
1

∥x∥
​ ∑
i=0
​ xi ∣i⟩,
​ using n = log
2
​ N qubits. 

Pros:

Exponential compression of data into few qubits.

Cons:

In general requires O(N )gates (or sophisticated circuit-design) to


prepare—state-prep can be a bottleneck.

Angle (Rotation) Encoding


Goal: Map each feature xi to rotation angles on individual qubits.

Single-Qubit Encoding:
xi xi

​ ​

∣ψi ⟩ = Ry (xi ) ∣0⟩ = cos


​ ​ ​ ​
∣0⟩ + sin ​
∣1⟩.
2 2

Quantum Machine Learning 5


Multi-Qubit Circuit:

Use one qubit per feature (total NN qubits), apply parameterized rotations
Ry (xi ),
​ ​
possibly interleaved with entangling gates.

Pros:

Shallow, local circuits; easy to implement on NISQ hardware.

Cons:

Linear in qubit count; limited expressivity compared to full amplitude


encoding.

Qubit-Efficient Mappings vs. Circuit Depth


Encoding Type Qubits Required Circuit Depth State-Prep Complexity

Amplitude Encoding log⁡


2N log2 N
​  O(N )(worstcase)  High

Angle Encoding N  O(1)–O(log N )  Low

Trade-Off:

Amplitude: minimal qubits, deep circuits.

Angle: minimal depth, many qubits.

Hybrid Strategies:

Block-encoding or QRAM techniques to load data more efficiently at the


cost of extra ancillas or hardware complexity.

Here’s a slide-by-slide blueprint for a thorough presentation on Quantum Machine


Learning (QML). You can adjust depth based on your audience’s background, and
add diagrams or code snippets where helpful.

Slide 6. Variational Quantum Circuits (VQC)


Parameterized Quantum Circuits (PQCs)
Ansatz Circuit: A sequence of fixed gates and parameterized rotations:

[ ]

Quantum Machine Learning 6


L n
U (θ) = ∏
ℓ=1
[ Uent (ϕ ) ∏
​ ​


j =1
​ Rj (θℓ,j )],
​ ​


where each Rj (θ)might be, e.g., ​

Ry (θ) = exp(−i

θ

2
​ Y ), 

and UentU_{\rm ent} is an entangling layer (e.g.\ CNOT network).

Quantum State Preparation:

∣ψ(θ)⟩ = U (θ) ∣0⟩


⊗n
. 

Hybrid Quantum–Classical Loop


1. Initialize parameters θ .
(0)

2. Quantum Step: Prepare ∣ψ(θ and measure a cost observable C (e.g.\


(t)
)⟩

Hamiltonian H for VQE, or a projector for classification):


(t) (t) (t)
L(θ ) = ⟨ψ(θ )∣ C ∣ψ(θ )⟩.

3. Classical Step: Use the measurement result to update θ , e.g.\ via gradient
descent:
(t+1) (t)
θ
k
​ = θ
k
​ − η
∂L

∂ θk ​
​ (parameter-shift rule for gradient estimation). 

4. Iterate until convergence or stopping criterion.

Example: VQE Adapted for Machine Learning


Original VQE Cost:
Minimize energy of Hamiltonian H :

E (θ) = ⟨ψ(θ)∣ H ∣ψ(θ)⟩. 

ML Adaptation:
Define a data-driven cost, e.g. for binary classification with labels
yi ∈{±1}y_i\in\{\pm1\}:
M

1
L(θ) = ​ ∑ [ 1 − yi ⟨ψ(θ, xi )⟩]
​ ​ ​
,

M i=1
+

where [ ⋅ ]+ is the hinge loss and ∣ψ(θ, xi )⟩encodes input xi .


​ ​ ​

Quantum Machine Learning 7


7. Quantum Neural Networks (QNN)
Qubit Layers as “Neurons”
Layer Structure: Each layer consists of parameterized single-qubit rotations
and entangling gates

Analogy:

Classical neuron: a = σ(w ⋅ x + b) 

Quantum neuron: prepare state ∣ψℓ−1 ⟩,apply parameterized unitary ​

Uℓ (θ ℓ ), yielding∣ψℓ ⟩.
​ ​ ​


Unitary Block Example:


n
Uℓ (θ ℓ ) = (⨂
​ ​

j =1

Ry (θℓ,j )) Uent ,
​ ​ ​


where Uent entangles qubits. ​

Entangling Gates as Nonlinear Activations


Entanglement Creates Correlations:

Just as nonlinear activation functions introduce nonlinearity in classical nets,


entangling operations allow the circuit to represent complex, non-separable
functions of the inputs.

Example Entangler: A chain of CNOTs


n−1
Uent = ∏ ​

j =1

CNOTj ,j +1 . ​


Training via the Parameter-Shift Rule


Goal: Minimize loss L(θ) computed from measurement statistics (e.g.\
expectation of an observable).

Gradient Estimation: For each parameter θk , ​

∂L

∂ θk ​
​ =
1

2
​ [ L(θ +
π

2
​ ek ) − L(θ −

π

2
​ ek )].



Quantum Machine Learning 8


Hybrid Optimization Loop:

1. Prepare ∣ψ(θ)⟩

2. Measure to estimate Land its gradients

3. Update θ with classical optimizer (e.g.\ SGD, Adam)

4. Repeat until convergence

Slide 8. Quantum Support Vector Machines (QSVM)


Kernel Trick in Hilbert Space
Classical SVM Dual Formulation
M M
maximize ​ ∑
i=1
​ αi − ​
1

2
​ ∑
i,j =1
​ αi αj yi yj K (xi , xj ),
​ ​ ​ ​ ​ ​ $
α

subject to

0 ≤ αi ≤ C , ∑ αi yi = 0.
​ ​ ​ ​

i

Key Insight: Only the kernel K (xi , xj ) ​ ​ = ⟨ϕ(xi ), ϕ(xj )⟩ ​ ​ is needed—no
explicit feature vectors.

Quantum Feature Maps & Kernel Estimation


1. Feature Map Circuit
Define a unitary Uϕ (x)that encodes data into a quantum state

∣ϕ(x)⟩ = Uϕ (x) ∣0⟩ ​


⊗n
. 

2. Quantum Kernel
Estimate overlaps in Hilbert space via
2 † 2
K (x, x ) =

⟨ϕ(x) ∣ ϕ(x )⟩



= ⟨0∣ U (x) Uϕ (x ) ∣0⟩

ϕ
​ ​

. 

3. Example (ZZ-Feature Map)

Uϕ (x) = exp(i ∑

j
​ ϕj (x) Zj + i ∑
​ ​

j <k
​ ϕjk (x) Zj Zk ) H
​ ​
⊗n
, 

where ϕj , ϕjk are nonlinear functions of input features.


​ ​

Quantum Machine Learning 9


Training via Classical Semidefinite Programming
Kernel Matrix Construction
Compute the M × M Gram matrix Kij ​
= K (xi , xj )
​ ​
on quantum hardware by
repeated state-overlap measurements.

Solve SVM QP/SDP

Use classical solvers (QP or semidefinite programming) on the kernel matrix to


find the optimal {αi }and thus the decision function

M
f (x) = sign(∑
i=1
​ αi yi K (xi , x) + b).
​ ​ ​


9. HHL Algorithm for Linear Systems

Solving Ax = b 
Problem Statement: Given an N × N Hermitian, sparse, well-conditioned
matrix Aand a state ∣b⟩encoding the vector b,prepare a state proportional to
∣x⟩ such that

A∣x⟩ = ∣b⟩. 

Quantum Complexity:
Under sparsity ss, condition number κ\kappa, and error tolerance ϵ\epsilon,
runtime scales as
2
O(log N ⋅ s κ /ϵ),
2


compared to O(N κ) classically.

Algorithm Steps
1. State Preparation
Encode binto ∣b⟩via amplitude encoding.

2. Hamiltonian Simulation

Simulate eiAt for various times tt using sparse Hamiltonian techniques.

3. Quantum Phase Estimation (QPE)

Quantum Machine Learning 10


Perform QPE on ∣b⟩w.r.t.\ A to decompose it into eigenbasis:

∣b⟩ = ∑
j
​ β j ∣ u j ⟩,
​ ​ A∣uj ⟩ = λj ∣uj ⟩.
​ ​ ​ 

4. Controlled Rotations
Apply a controlled rotation on an ancilla qubit to map λj\lambda_j to 1/
λj1/\lambda_j:
2

∣λj ⟩∣0⟩ ↦ ∣λj ⟩(


​ ​
1 −
C

λ
2
​ ​ ∣0⟩ +
C

λj ​

∣1⟩). 
j

5. Uncompute & Post-selection

Invert the QPE to erase the eigenvalue register, then measure the ancilla and
post-select on ∣1⟩to collapse onto

j
​ βj ​
C

λj ​
​ ∣uj ⟩ ∝ ∣x⟩.
​ 

Use Cases & Limitations


Subroutine in ML:

Quantum Ridge Regression: solves (A + αI )x = b. 

Least-Squares Classification: embeds linear solves into broader


algorithms.

Limitations:

State Preparation: loading bmay cost O(N )gates or require QRAM.

Readout Overhead: extracting full xrequires many measurements or


tomography.

Conditioning & Sparsity: efficiency depends critically on κand sparsity s.

10. Quantum Clustering & PCA


Quantum Principal Component Analysis (qPCA)
Goal: Extract principal components (eigenvectors/eigenvalues) of data
covariance matrix

Density Matrix Encoding: Given zero-mean data samples {xi },define ​

Quantum Machine Learning 11


m
M
i=1
∣xi ⟩⟨xi ∣,
​ ​ ​ 

where ∣xi ⟩is amplitude-encoded.


Eigenvalue Estimation via QPE:

1. Perform quantum phase estimation on ρas if it were a Hamiltonian:

ρ∣uj ⟩ = λj ∣uj ⟩.
​ ​ ​ 

2. Read out estimates of λj (principal variances) and project onto ∣uj ⟩.
​ ​

Lloyd’s Quantum k-Means


Classical Lloyd’s k-Means: Iteratively assign points to nearest centroid, then
update centroids.

Quantum Speed-Ups:

1. Distance Estimation: Use a swap test or inner-product estimation circuit


to compute distances
∥x − ck ∥ ​
2
= ⟨x∣x⟩ + ⟨ck ∣ck ⟩ − 2 ℜ⟨x∣ck ⟩inO(log⁡N )O(log N )time.
​ ​ ​ 

2. Amplitude Amplification: Quadratically speed up the search over kk


clusters for nearest centroid.

3. Centroid Update: Rebuild centroid states via superposition of assigned


points (requires efficient state preparation or QRAM).

Speed-Up vs. Data Loading Trade-Offs

Task Classical Quantum

PCA eigenvalue estimation O(N


2
)–O(N
3
)  O(log N )(viaQPE onρ) 

k-Means distance computation O(N k) per point O(k log N )(swap tests) 

Data/state loading O(N ) (classical) O(N ) − O(N log N )(QRAM ) 

Key Caveat: Both qPCA and quantum k-means rely on efficient amplitude
encoding or QRAM; without it, data-loading dominates runtime.

11. Hybrid Architectures & Quantum Advantage

Quantum Machine Learning 12


When & Where We Expect Advantage
Quantum-Classical Co-Design:

Combine classical preprocessing (e.g.\ dimensionality reduction, feature


selection) with quantum subroutines (e.g.\ VQE, QSVM kernels) to tackle
bottlenecks.

Regimes of Interest:

High-dimensional linear algebra: sparse, well-conditioned problems


where HHL-style solvers could outpace direct classical methods.

Nonconvex optimization: variational loops may escape classical plateaus


via quantum-induced landscape features.

Complexity Perspective:
Classical cost Ccl ​ ∼ O(N
p
) vs. quantum cost Cq ​ ∼ O(poly(log N )) in ideal
scenarios.

Small-Scale NISQ Demos


Variational Chemistry (VQE):
IBM & Rigetti mapped small molecules (e.g.\ H2\mathrm{H}_2, LiH) onto 4–6
qubits, achieving chemical accuracy ∼ 10
−3
Ha .

Quantum Approximate Optimization Algorithm (QAOA):

Google’s Sycamore ran depth − p = 1QAOA on random MaxCut instances


(Graphs up to 23 nodes), showing slight outperformance of random classical
heuristics.

Quantum Kernels:

Xanadu demonstrated QSVM on Iris dataset analogs using photonic hardware,


matching classical SVM accuracy with only 8 modes.

Benchmarking Classical vs. Quantum Pipelines


Cross-Entropy Benchmarking (XEB)

Quantum Machine Learning 13


Measures fidelity of sampling from an ideal random circuit. Given observed
bitstrings xx with probabilities p(x)p(x), the linear XEB fidelity is
FXEB = 2 ​
n
Ex∼exp [p(x)] − 1,
​ 

where nn is qubit count.

Cost Comparisons:

Pipeline Component Classical Cost Quantum Cost

Kernel matrix build (QSVM) O(M


2
N)  O(M
2
log N ) 

Energy evaluation (VQE)  


3
O(N ) O(shots × depth)

Sampling (XEB) exp(n)  O(shots × depth) 

12. Software Frameworks & Toolchains


Qiskit Machine Learning (IBM)
Overview: Built on Qiskit Terra & Aqua, provides algorithms & primitives for
QML.

Getting Started:

pip install qiskit-machine-learning

from qiskit_machine_learning.kernels import QuantumKernel

PennyLane (Xanadu)
Overview: Plugin-based library for differentiable quantum computing;
integrates with PyTorch, TensorFlow, JAX.

Getting Started:

pip install pennylane pennylane-qiskit

Quantum Machine Learning 14


import pennylane as qml
dev = [Link]("[Link]", wires=2)

TensorFlow Quantum (Google)


Overview: TensorFlow extension for QML; implements quantum layers &
Keras integration.

Getting Started:

pip install tensorflow-quantum cirq

import tensorflow_quantum as tfq

Tutorials & Open-Source Demos


Qiskit:

“Hello, Quantum Machine Learning” notebook: examples of QSVM, VQE.

PennyLane:

“Quantum Node” tutorials for building QNNs in PyTorch/TensorFlow.

TFQ:

“Quantum Convolutional Network” demo for image classification.

13. Summary & Takeaways


Bullets:

QML blends QC’s high-dimensional feature spaces with ML workflows

Variational and hybrid methods dominate today’s demos

Major hurdles remain in data loading, noise, and optimization

Exciting ecosystem of libraries and experiments is rapidly growing

Quantum Machine Learning 15


14. References
Schuld, Maria, and Francesco Petruccione. Supervised Learning with
Quantum Computers. Springer, 2018.

Biamonte et al., “Quantum Machine Learning,” Nature 549, 195–202 (2017).

Cerezo et al., “Variational Quantum Algorithms,” Nature Reviews Physics 3,


625–644 (2021).

Quantum Machine Learning 16

You might also like