Quantum Machine Learning
Quantum Machine Learning
1. Title Slide
Title: Quantum Machine Learning
Date
(x0 , … , xN −1 )
using only log2 N qubits via amplitude encoding:
N −1
∣x⟩ =
1
∥x∥
∑
i=0
xi ∣i⟩,
∥x∥∥y∥ i=0
Unsupervised Learning
Reinforcement Learning
2. Model Training
3. Inference
Classical Bottlenecks
Curse of Dimensionality
Optimization Landscapes
Non-convex loss surfaces (e.g.\ deep neural nets) exhibit local minima, saddle
points, and plateaus, making training slow and sometimes unstable.
Superposition
∣ψ⟩ = cos
θ
2
∣0⟩ + e
iϕ
sin
θ
2
∣1⟩.
Entanglement
∣Φ
+
⟩ =
1
2
(∣00⟩ + ∣11⟩) ,
0 1
Pauli-X (bit-flip): X = ( )
1 0
1 1
Hadamard: H creates equal superpositions
1
= ( )
2
1 −1
Multi-Qubit Gates
Quantum Circuits
Gates are applied in sequence (and in parallel on different qubits) to build up
complex unitary transformations.
∣0⟩—[H ]— ●—
│
∣0⟩———— ⊕ —
Measuring in the {∣0⟩, ∣1⟩}basis yields outcome 0with probability α∣2 and 11
with probability ∣β ∣2 .
State Collapse
State Preparation:
N −1
∣ψx ⟩ =
1
∥x∥
∑
i=0
xi ∣i⟩,
using n = log
2
N qubits.
Pros:
Cons:
Single-Qubit Encoding:
xi xi
Use one qubit per feature (total NN qubits), apply parameterized rotations
Ry (xi ),
possibly interleaved with entangling gates.
Pros:
Cons:
Trade-Off:
Hybrid Strategies:
[ ]
ℓ
j =1
Rj (θℓ,j )],
Ry (θ) = exp(−i
θ
2
Y ),
(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).
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
+
Analogy:
Uℓ (θ ℓ ), yielding∣ψℓ ⟩.
j =1
Ry (θℓ,j )) Uent ,
j =1
CNOTj ,j +1 .
∂L
∂ θk
=
1
2
[ L(θ +
π
2
ek ) − L(θ −
π
2
ek )].
1. Prepare ∣ψ(θ)⟩
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.
2. Quantum Kernel
Estimate overlaps in Hilbert space via
2 † 2
K (x, x ) =
′
⟨ϕ(x) ∣ ϕ(x )⟩
′
= ⟨0∣ U (x) Uϕ (x ) ∣0⟩
ϕ
′
.
Uϕ (x) = exp(i ∑
j
ϕj (x) Zj + i ∑
j <k
ϕjk (x) Zj Zk ) H
⊗n
,
M
f (x) = sign(∑
i=1
αi yi K (xi , x) + b).
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
Algorithm Steps
1. State Preparation
Encode binto ∣b⟩via amplitude encoding.
2. Hamiltonian Simulation
∣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
λ
2
∣0⟩ +
C
λj
∣1⟩).
j
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⟩.
Limitations:
ρ∣uj ⟩ = λj ∣uj ⟩.
2. Read out estimates of λj (principal variances) and project onto ∣uj ⟩.
Quantum Speed-Ups:
k-Means distance computation O(N k) per point O(k log N )(swap tests)
Key Caveat: Both qPCA and quantum k-means rely on efficient amplitude
encoding or QRAM; without it, data-loading dominates runtime.
Regimes of Interest:
Complexity Perspective:
Classical cost Ccl ∼ O(N
p
) vs. quantum cost Cq ∼ O(poly(log N )) in ideal
scenarios.
Quantum Kernels:
Cost Comparisons:
Getting Started:
PennyLane (Xanadu)
Overview: Plugin-based library for differentiable quantum computing;
integrates with PyTorch, TensorFlow, JAX.
Getting Started:
Getting Started:
PennyLane:
TFQ: