Quantum Machine Learning

Introduction to Quantum Machine Learning

Quantum Machine Learning (QML) is an interdisciplinary field at the intersection of quantum computing and machine learning. It explores how quantum phenomena—superposition, entanglement, and interference—can be leveraged to accelerate or improve classical machine learning algorithms. As quantum hardware matures, QML represents one of the most promising application domains for near-term quantum devices.

📖 Quantum Machine Learning (QML)

A research discipline that investigates the use of quantum computing resources—qubits, quantum gates, and quantum algorithms—to enhance, speed up, or fundamentally alter machine learning tasks such as classification, regression, clustering, and generative modelling.

The promise of QML rests on two pillars: (1) quantum computers can represent and manipulate exponentially large state spaces using polynomial physical resources, and (2) quantum algorithms can sometimes achieve provable speedups over their classical counterparts for specific sub-routines commonly used in ML, such as linear algebra operations, sampling, and optimisation.

💡 Why Study QML for GATE DA?

While GATE DA does not yet include quantum computing as a core topic, understanding QML helps you appreciate the frontier of AI research. Questions on computational complexity, linear algebra, and probabilistic models—all central to QML—are very much within the GATE DA syllabus.

Qubits and Quantum States

The classical bit takes on a value of 0 or 1. A qubit (quantum bit) is the quantum analogue: it can exist in a superposition of |0⟩ and |1⟩ simultaneously.

📖 Qubit

A qubit is a two-level quantum system whose state is described by a vector in a two-dimensional complex Hilbert space: |ψ⟩ = α|0⟩ + β|1⟩, where α and β are complex amplitudes satisfying |α|² + |β|² = 1.

Key properties of qubits that make them powerful for computation:

  • Superposition: A qubit can encode a weighted combination of 0 and 1, enabling exploration of multiple computational paths simultaneously.
  • Measurement: Upon measurement, a qubit collapses to |0⟩ with probability |α|² or to |1⟩ with probability |β|².
  • Bloch Sphere: A single-qubit pure state can be visualised as a point on the Bloch sphere, parameterised by angles θ and φ.

🔬 Example — Single Qubit State

The state |+⟩ = (1/√2)|0⟩ + (1/√2)|1⟩ is an equal superposition. Measuring it yields 0 or 1 each with 50% probability. This is created from |0⟩ by applying a Hadamard gate.

For n qubits, the combined state lives in a 2n-dimensional Hilbert space. This exponential growth is the source of quantum computing's potential power—with just 300 qubits, the state space exceeds the number of atoms in the observable universe.

Superposition & Entanglement

Superposition allows a quantum register of n qubits to represent 2n basis states simultaneously. This does not mean we can read out all 2n values at once—measurement collapses the state—but quantum algorithms cleverly use interference to amplify the probability of correct outcomes.

📖 Quantum Entanglement

Entanglement is a quantum correlation between two or more qubits such that the state of the composite system cannot be factored into independent single-qubit states. If qubits A and B are entangled, measuring A instantaneously determines the outcome of measuring B, regardless of distance.

🔬 Bell State (Maximally Entangled Pair)

The Bell state |Φ+⟩ = (1/√2)(|00⟩ + |11⟩) is the simplest entangled state. If the first qubit is measured as 0, the second is guaranteed to also be 0, and vice versa. This two-qubit state cannot be written as a tensor product of individual qubit states.

Entanglement is a key resource for quantum algorithms. In QML, entanglement enables:

  • Encoding complex correlations between features in a quantum feature map.
  • Creating highly expressive parameterised quantum circuits that classical models cannot efficiently simulate.
  • Enabling quantum teleportation of information across distributed quantum networks.

⚠️ Common Misconception

Entanglement does not enable faster-than-light communication. While measurement outcomes are correlated, no usable information is transmitted without a classical communication channel. This is formalised by the no-communication theorem.

Quantum Gates & Circuits

Quantum computation proceeds by applying a sequence of quantum gates—unitary transformations—to qubits. A quantum circuit is a directed acyclic graph of gates applied over time.

📖 Quantum Gate

A quantum gate is a unitary operator U acting on one or more qubits. Unitarity (U†U = I) guarantees that quantum evolution is reversible and preserves the total probability of the quantum state.

Important single-qubit gates:

GateSymbolAction
HadamardHCreates equal superposition: H|0⟩ = |+⟩
Pauli-XXBit flip: X|0⟩ = |1⟩ (quantum NOT)
Pauli-ZZPhase flip: Z|1⟩ = −|1⟩
Rotation-YRY(θ)Rotates state around Y-axis by angle θ
Phase GateSApplies a π/2 phase to |1⟩

Important multi-qubit gates:

  • CNOT (Controlled-NOT): Flips the target qubit if the control qubit is |1⟩. Essential for creating entanglement.
  • CZ (Controlled-Z): Applies a Z gate to the target qubit conditioned on the control being |1⟩.
  • SWAP: Exchanges the states of two qubits.
  • Toffoli (CCNOT): A three-qubit gate; universal for classical reversible computation.

🔬 Building a Bell State Circuit

To create the Bell state |Φ+⟩: (1) Start with |00⟩. (2) Apply H to qubit 0: (|0⟩ + |1⟩)/√2 ⊗ |0⟩. (3) Apply CNOT with qubit 0 as control and qubit 1 as target: (|00⟩ + |11⟩)/√2. This two-gate circuit is the building block of many quantum algorithms.

💡 Universal Gate Sets

The set {H, T, CNOT} is universal for quantum computation, meaning any unitary operation can be approximated to arbitrary precision using only these gates. This is analogous to how {AND, NOT} is universal for classical Boolean logic.

Variational Quantum Circuits (VQCs)

Variational Quantum Circuits (also called parameterised quantum circuits or PQCs) are the workhorses of near-term QML. They combine quantum circuits with classical optimisation in a hybrid quantum-classical loop.

📖 Variational Quantum Circuit

A VQC is a quantum circuit U(θ) whose gates depend on tunable parameters θ. A classical optimiser iteratively adjusts θ to minimise a cost function computed from measurement outcomes, analogous to training weights in a neural network.

The VQC training loop:

  1. State Preparation: Encode classical data x into a quantum state using a feature map circuit S(x).
  2. Parameterised Evolution: Apply variational layers W(θ) consisting of parameterised rotation gates and entangling gates.
  3. Measurement: Measure qubits to obtain expectation values of observables.
  4. Classical Optimisation: Compute the loss function and update θ using gradient-based (parameter-shift rule) or gradient-free optimisers.
  5. Repeat: Iterate until convergence.

🔬 Variational Quantum Classifier

To classify two-feature data into two classes: (1) Encode features x1, x2 using RY rotations on two qubits. (2) Apply a layer of CNOT + RY(θi) gates. (3) Measure the first qubit in the Z basis. (4) If ⟨Z⟩ > 0, predict class 0; else class 1. (5) Optimise θ to minimise cross-entropy loss over training data.

⚠️ Barren Plateau Problem

As the number of qubits and circuit depth increases, the gradient of the cost function can become exponentially small across the parameter landscape—a phenomenon called barren plateaus. This makes training deep VQCs extremely difficult, analogous to the vanishing gradient problem in classical deep learning but potentially more severe.

Quantum Kernel Methods

Quantum kernel methods offer an alternative to variational approaches. Instead of training a parameterised circuit, they use a fixed quantum feature map to compute kernel values that are then fed into a classical SVM or other kernel machine.

📖 Quantum Kernel

A quantum kernel K(xi, xj) is defined as the inner product of quantum feature states: K(xi, xj) = |⟨φ(xi)|φ(xj)⟩|², where |φ(x)⟩ = U(x)|0⟩ is the quantum state produced by encoding data point x via a quantum circuit U(x).

Steps in quantum kernel classification:

  1. Choose a quantum feature map circuit U(x) (e.g., ZZ-feature map with entanglement).
  2. For each pair of training points (xi, xj), prepare |φ(xi)⟩, then apply U†(xj) and measure the probability of the all-zeros state.
  3. Construct the kernel matrix K of size N × N.
  4. Train a classical SVM using this quantum kernel matrix.

🔧 Quantum Kernel Advantage Criterion

A quantum kernel can provide advantage over classical kernels only if the quantum feature map produces states that are hard for classical computers to simulate. Specifically, if the quantum kernel can be efficiently computed classically, there is no computational advantage. The geometric difference between the quantum and classical kernel matrices serves as a diagnostic for potential quantum advantage.

💡 Projected Quantum Kernels

Standard quantum kernels suffer from the "curse of dimensionality in Hilbert space"—exponentially large feature spaces can lead to kernel values that are exponentially concentrated near zero. Projected quantum kernels address this by projecting back to a lower-dimensional space using reduced density matrices, improving trainability.

The NISQ Era

Current quantum computers are in the Noisy Intermediate-Scale Quantum (NISQ) era, characterised by devices with tens to a few thousand qubits that lack full error correction.

📖 NISQ (Noisy Intermediate-Scale Quantum)

A term coined by John Preskill (2018) to describe current quantum processors with 50–1000+ qubits that are too noisy for fault-tolerant computation but large enough to potentially demonstrate quantum advantage for specific tasks. Gate errors, decoherence, and limited connectivity constrain the complexity of executable circuits.

Key challenges of NISQ devices for QML:

  • Gate Fidelity: Two-qubit gate errors are typically 0.1–1%, limiting circuit depth to ~100–1000 gates before noise overwhelms the signal.
  • Qubit Connectivity: Physical qubits are not all-to-all connected, requiring SWAP gates that add noise and depth.
  • Decoherence: Qubits lose their quantum state over time (T1 relaxation, T2 dephasing), setting a time budget for computation.
  • Readout Errors: Measurements are imperfect, introducing statistical noise in output probabilities.
  • Shot Noise: Finite measurement samples mean expectation values are estimated with statistical uncertainty proportional to 1/√Nshots.

🔬 NISQ-Friendly QML Algorithms

Algorithms designed for NISQ hardware include: (1) VQE (Variational Quantum Eigensolver) for chemistry simulations, (2) QAOA (Quantum Approximate Optimisation Algorithm) for combinatorial problems, (3) Quantum classifiers using shallow VQCs, and (4) Quantum kernel estimators. All use hybrid quantum-classical loops to keep quantum circuit depth low.

Quantum Advantage Claims

A central question in QML is whether quantum computers can outperform classical computers for practical ML tasks. This is distinct from general quantum computational advantage (quantum supremacy).

📖 Quantum Advantage

A quantum algorithm is said to provide quantum advantage (or quantum speedup) for a task if it solves the task provably faster or with fewer resources than the best-known classical algorithm. Quantum supremacy is the more specific claim that a quantum device performs a computation that no classical computer can complete in feasible time.

Milestones and claims in quantum advantage:

  • Google Sycamore (2019): Claimed quantum supremacy for random circuit sampling—a task with limited practical utility but demonstrating a computational separation.
  • Xanadu Borealis (2022): Demonstrated advantage in Gaussian boson sampling using photonic quantum computing.
  • IBM Heron (2024–25): Focused on utility-scale quantum computing with error mitigation, showing quantum processors can produce correct results for 100+ qubit circuits.

⚠️ QML Advantage Is Not Guaranteed

Many proposed QML speedups rely on the assumption that data is already in quantum form (quantum RAM). For classical data, the cost of loading data into a quantum state can negate any speedup. Furthermore, "dequantisation" results have shown that some quantum-inspired classical algorithms can match quantum speedups for tasks like recommendation systems.

🔧 Conditions for QML Advantage

Provable QML advantage requires: (1) The learning problem must have structure exploitable by quantum mechanics (e.g., data generated by quantum processes). (2) The quantum feature map must be classically intractable to simulate. (3) The quantum algorithm must provide a meaningful speedup that survives the overhead of data encoding and error mitigation. (4) The advantage must hold against the best classical algorithm, not just a naive baseline.

Key QML Algorithms

Several landmark algorithms form the foundation of QML research:

AlgorithmTaskSpeedupCaveat
HHL (2009)Linear systemsExponential (in matrix size)Requires qRAM; output is quantum state
Quantum PCAPrincipal componentsExponentialNeeds density matrix exponentiation
Quantum SVMClassificationPolynomial/ExponentialDepends on kernel evaluation cost
QAOACombinatorial optimisationHeuristicNo proven exponential speedup
Quantum Boltzmann MachineGenerative modellingQuadratic (sampling)Hardware-demanding
Quantum GANData generationHeuristicTrainability challenges

🔬 HHL Algorithm Intuition

The HHL algorithm solves Ax = b for an N × N sparse matrix A in time O(log N), compared to classical O(N) for the best iterative methods. The catch: the input b must be a quantum state, and the output x is also a quantum state from which only limited information can be extracted per measurement. This makes it powerful for specific quantum subroutines but not a drop-in replacement for classical linear solvers.

Future Outlook & Summary

Quantum Machine Learning sits at the frontier of both quantum computing and artificial intelligence. While the NISQ era presents significant hardware challenges, rapid progress in error correction, qubit quality, and algorithm design suggests that practical QML applications may emerge in the coming decade.

💡 Key Frameworks and Tools

Qiskit (IBM), Cirq (Google), PennyLane (Xanadu), and TensorFlow Quantum are leading open-source frameworks for QML research. PennyLane is particularly popular because it integrates seamlessly with PyTorch and TensorFlow, enabling hybrid quantum-classical model training.

Summary of key concepts:

  • Qubits leverage superposition and entanglement to represent exponentially large state spaces.
  • Quantum gates perform unitary transformations; universal gate sets can approximate any quantum operation.
  • Variational Quantum Circuits are the dominant paradigm for NISQ-era QML, using hybrid quantum-classical optimisation.
  • Quantum kernel methods map data into quantum Hilbert space for classical kernel-based learning.
  • The NISQ era is characterised by noisy, limited-qubit devices that constrain circuit depth and complexity.
  • Quantum advantage for ML tasks is an active research question with both promising and cautionary results.
  • Practical QML likely requires fault-tolerant quantum hardware or cleverly designed NISQ algorithms.

⚠️ Hype vs. Reality

While QML is a genuinely exciting field, be cautious of overclaims. Many proposed "exponential speedups" have caveats (qRAM assumptions, dequantisation). Focus on understanding the fundamentals—linear algebra, probability, and optimisation—that underpin both quantum and classical ML. These foundations are what GATE DA tests.