Variational Quantum Machine Learning Algorithms

Variational quantum machine learning algorithms are a hybrid approach in which a parameterized quantum circuit is tuned by a classical optimizer to approximate solutions to complex problems.

by Frank Zickert
September 15, 2025
Variational Quantum Machine Learning Algorithms

Variational Quantum Machine Learning algorithms are the defining approach of the era of Noisy Intermediate-Scale Quantum refers to the current generation of quantum devices that have enough qubits to run non-trivial algorithms but are still small and error-prone, limiting their reliability and scalability.
Learn more about Noisy Intermediate-Scale Quantum
medium-sized quantum computers.

    At the highest level, a variational quantum algorithm contains a simple feedback loop:
  1. Prepare a A quantum state is the complete mathematical description of a quantum system, containing all the information needed to predict measurement outcomes. It’s usually represented by a wavefunction or a state vector in a Hilbert space. The state defines probabilities, not certainties, for observable quantities like position, momentum, or spin.
    Learn more about Quantum State
    using a A **Parameterized Quantum Circuit (PQC)** is a quantum circuit where certain gate operations depend on adjustable parameters—typically real numbers representing rotation angles. These parameters are tuned (often by classical optimization) to perform a specific task, such as minimizing a cost function. PQCs are central to **variational quantum algorithms**, where quantum computation provides state preparation and measurement, and a classical computer optimizes the parameters.
    Learn more about Parameterized Quantum Circuit
    (An Ansatz is a chosen form or structure of a quantum state (often parameterized) used as a starting point for algorithms like the Variational Quantum Eigensolver. It defines how qubits are entangled and rotated, and its parameters are optimized to approximate the solution to a problem. The quality of the Ansatz directly affects the accuracy and efficiency of the computation.
    Learn more about Ansatz
    )
    .
  2. In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually or ), with probabilities determined by the amplitudes of those states. After measurement, the qubit’s state becomes definite, destroying the original superposition.
    Learn more about Measurement
    an In quantum computing, an **observable** is a physical quantity (like energy, spin, or position) that can be **measured** from a quantum state. Mathematically, it’s represented by a **Hermitian operator**, whose eigenvalues correspond to the possible measurement outcomes. When you measure an observable, the quantum state **collapses** into one of its eigenstates, yielding one of those eigenvalues as the result.
    Learn more about Observable
    to obtain the The expectation value is the average result you'd get if you repeated a measurement of a quantity many times under identical conditions. Mathematically, it’s the weighted average of all possible outcomes, where each outcome is weighted by its probability. In quantum mechanics, it represents the average value of an observable calculated from the wavefunction.
    Learn more about Expectation Value
    .
  3. Update the parameters with a classical Optimization is the process of finding the best possible solution to a problem within given constraints. It involves adjusting variables to minimize or maximize an objective function, such as cost, time, or efficiency. In simple terms, it’s about achieving the most effective outcome with the least waste or effort.
    Learn more about Optimization
    to minimize the A **cost function** measures how far a model’s predictions are from the actual outcomes by assigning a numerical “error” value. The goal of training is to **minimize this cost**, meaning the model’s predictions get closer to reality. Different cost functions (e.g., mean squared error, cross-entropy) are used depending on the type of prediction problem.
    Learn more about Cost Function
    .
  4. This process repeats until the A **cost function** measures how far a model’s predictions are from the actual outcomes by assigning a numerical “error” value. The goal of training is to **minimize this cost**, meaning the model’s predictions get closer to reality. Different cost functions (e.g., mean squared error, cross-entropy) are used depending on the type of prediction problem.
    Learn more about Cost Function
    no longer improves.

Parameterized Quantum Circuit

The tunable gate toward practical Quantum Machine Learning
5 min
Parameterized quantum circuits let us embed classical data into quantum states, tune them with adjustable gates, and read out predictions through measurement. The real question is whether these simple building blocks can be scaled into architectures that deliver genuine quantum advantage.
Figure 1 Variational Quantum Algorithm (VQA) Feedback Loop

It looks almost exactly like training a Machine Learning is an approach on solving problems by deriving the rules from data instead of explicitly programming.
Learn more about Machine Learning
A **model** in machine learning is a mathematical representation of patterns learned from data. It takes **inputs** (features) and produces **outputs** (predictions or classifications) based on relationships it has identified during training. Essentially, it’s a function that generalizes from examples to make decisions or predictions on new data.
Learn more about Model
. The An Ansatz is a chosen form or structure of a quantum state (often parameterized) used as a starting point for algorithms like the Variational Quantum Eigensolver. It defines how qubits are entangled and rotated, and its parameters are optimized to approximate the solution to a problem. The quality of the Ansatz directly affects the accuracy and efficiency of the computation.
Learn more about Ansatz
is the A **model** in machine learning is a mathematical representation of patterns learned from data. It takes **inputs** (features) and produces **outputs** (predictions or classifications) based on relationships it has identified during training. Essentially, it’s a function that generalizes from examples to make decisions or predictions on new data.
Learn more about Model
, the In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually or ), with probabilities determined by the amplitudes of those states. After measurement, the qubit’s state becomes definite, destroying the original superposition.
Learn more about Measurement
is its prediction, the A **cost function** measures how far a model’s predictions are from the actual outcomes by assigning a numerical “error” value. The goal of training is to **minimize this cost**, meaning the model’s predictions get closer to reality. Different cost functions (e.g., mean squared error, cross-entropy) are used depending on the type of prediction problem.
Learn more about Cost Function
measures the error, and the Optimization is the process of finding the best possible solution to a problem within given constraints. It involves adjusting variables to minimize or maximize an objective function, such as cost, time, or efficiency. In simple terms, it’s about achieving the most effective outcome with the least waste or effort.
Learn more about Optimization
updates the parameters. Conceptually, this results in a simple recipe: alternate between running the A **Parameterized Quantum Circuit (PQC)** is a quantum circuit where certain gate operations depend on adjustable parameters—typically real numbers representing rotation angles. These parameters are tuned (often by classical optimization) to perform a specific task, such as minimizing a cost function. PQCs are central to **variational quantum algorithms**, where quantum computation provides state preparation and measurement, and a classical computer optimizes the parameters.
Learn more about Parameterized Quantum Circuit
and adjusting the parameters until the A **cost function** measures how far a model’s predictions are from the actual outcomes by assigning a numerical “error” value. The goal of training is to **minimize this cost**, meaning the model’s predictions get closer to reality. Different cost functions (e.g., mean squared error, cross-entropy) are used depending on the type of prediction problem.
Learn more about Cost Function
converges.

This high-level recipe is neat, but incomplete. It obscures the fact that not all An Ansatz is a chosen form or structure of a quantum state (often parameterized) used as a starting point for algorithms like the Variational Quantum Eigensolver. It defines how qubits are entangled and rotated, and its parameters are optimized to approximate the solution to a problem. The quality of the Ansatz directly affects the accuracy and efficiency of the computation.
Learn more about Ansatz
, In quantum computing, an **observable** is a physical quantity (like energy, spin, or position) that can be **measured** from a quantum state. Mathematically, it’s represented by a **Hermitian operator**, whose eigenvalues correspond to the possible measurement outcomes. When you measure an observable, the quantum state **collapses** into one of its eigenstates, yielding one of those eigenvalues as the result.
Learn more about Observable
, or Optimization is the process of finding the best possible solution to a problem within given constraints. It involves adjusting variables to minimize or maximize an objective function, such as cost, time, or efficiency. In simple terms, it’s about achieving the most effective outcome with the least waste or effort.
Learn more about Optimization
behave the same way
.

Since Variational Quantum Machine Learning algorithms look pretty much like classic Machine Learning is an approach on solving problems by deriving the rules from data instead of explicitly programming.
Learn more about Machine Learning
algorithms, it stands to reason that greater depth also means higher quality. In Deep learning is a branch of machine learning that uses multi-layered neural networks to automatically learn complex patterns from data. Each layer transforms raw input into increasingly abstract representations, allowing the system to perform tasks like image recognition or language understanding without explicit feature engineering. It relies heavily on large datasets and high computational power for training.
Learn more about Deep Learning
, for example, adding layers generally increases Expressiveness in quantum computing refers to how effectively a quantum model (like a variational circuit) can represent complex functions or quantum states. A more expressive model can capture richer correlations and solve more complex problems, but may also be harder to train. It’s roughly analogous to the “capacity” or “model complexity” in classical machine learning.
Learn more about Expressiveness
and improves Accuracy is the proportion of correctly predicted examples (both true positives and true negatives) out of all examples. It’s calculated as correct predictions divided by total predictions. It works well when classes are balanced, but can be misleading if one class dominates.
Learn more about Accuracy
when sufficient data is available. With Variational Quantum Machine Learning algorithms, however, Circuit depth in quantum computing is the number of layers of quantum gates that must be applied sequentially, where gates acting on different qubits in parallel count as one layer. It measures how long a quantum computation takes, assuming gates in the same layer happen simultaneously. Lower depth is crucial because qubits lose coherence over time, so deep circuits are more error-prone.
Learn more about Circuit Depth
quickly becomes a disadvantage.

Optimization does not work on a flat cost landscape
Figure 2 Optimization does not work on a flat cost landscape

Deeper An Ansatz is a chosen form or structure of a quantum state (often parameterized) used as a starting point for algorithms like the Variational Quantum Eigensolver. It defines how qubits are entangled and rotated, and its parameters are optimized to approximate the solution to a problem. The quality of the Ansatz directly affects the accuracy and efficiency of the computation.
Learn more about Ansatz
cover a larger number of A quantum state is the complete mathematical description of a quantum system, containing all the information needed to predict measurement outcomes. It’s usually represented by a wavefunction or a state vector in a Hilbert space. The state defines probabilities, not certainties, for observable quantities like position, momentum, or spin.
Learn more about Quantum State
, but this Expressiveness in quantum computing refers to how effectively a quantum model (like a variational circuit) can represent complex functions or quantum states. A more expressive model can capture richer correlations and solve more complex problems, but may also be harder to train. It’s roughly analogous to the “capacity” or “model complexity” in classical machine learning.
Learn more about Expressiveness
comes at the expense of In quantum computing, *trainability* refers to how effectively a quantum machine learning model (like a variational quantum circuit) can be optimized to minimize its loss function. It depends on whether small parameter changes produce meaningful gradients rather than vanishing ones. Poor trainability—often caused by issues like barren plateaus—means the model can’t learn efficiently because gradients become too small to guide improvement.
Learn more about Trainability
McClean, J.R., 2018, Nature Communications, Vol. 9, pp. 4812. The Optimization is the process of finding the best possible solution to a problem within given constraints. It involves adjusting variables to minimize or maximize an objective function, such as cost, time, or efficiency. In simple terms, it’s about achieving the most effective outcome with the least waste or effort.
Learn more about Optimization
then sees a flat landscape and is unable to distinguish good updates from bad ones. In practice, this means that doubling the Circuit depth in quantum computing is the number of layers of quantum gates that must be applied sequentially, where gates acting on different qubits in parallel count as one layer. It measures how long a quantum computation takes, assuming gates in the same layer happen simultaneously. Lower depth is crucial because qubits lose coherence over time, so deep circuits are more error-prone.
Learn more about Circuit Depth
rarely leads to a doubling of performance. Instead, it often completely suppresses the learning signal.

The tension is structural: shallow circuits are In quantum computing, *trainability* refers to how effectively a quantum machine learning model (like a variational quantum circuit) can be optimized to minimize its loss function. It depends on whether small parameter changes produce meaningful gradients rather than vanishing ones. Poor trainability—often caused by issues like barren plateaus—means the model can’t learn efficiently because gradients become too small to guide improvement.
Learn more about Trainability
but limited, deep circuits are Expressiveness in quantum computing refers to how effectively a quantum model (like a variational circuit) can represent complex functions or quantum states. A more expressive model can capture richer correlations and solve more complex problems, but may also be harder to train. It’s roughly analogous to the “capacity” or “model complexity” in classical machine learning.
Learn more about Expressiveness
but untrainable. When designing An Ansatz is a chosen form or structure of a quantum state (often parameterized) used as a starting point for algorithms like the Variational Quantum Eigensolver. It defines how qubits are entangled and rotated, and its parameters are optimized to approximate the solution to a problem. The quality of the Ansatz directly affects the accuracy and efficiency of the computation.
Learn more about Ansatz
, the focus is therefore not on more layers but on a balance between Expressiveness in quantum computing refers to how effectively a quantum model (like a variational circuit) can represent complex functions or quantum states. A more expressive model can capture richer correlations and solve more complex problems, but may also be harder to train. It’s roughly analogous to the “capacity” or “model complexity” in classical machine learning.
Learn more about Expressiveness
and optimization stability (In quantum computing, *trainability* refers to how effectively a quantum machine learning model (like a variational quantum circuit) can be optimized to minimize its loss function. It depends on whether small parameter changes produce meaningful gradients rather than vanishing ones. Poor trainability—often caused by issues like barren plateaus—means the model can’t learn efficiently because gradients become too small to guide improvement.
Learn more about Trainability
)
.

Looking at the top level, three components define how a Variational Quantum Machine Learning algorithm really works. Together, Encoding is the process of converting information from one form into another, usually so it can be stored, transmitted, or processed more efficiently. For example, text can be encoded into binary for computers to handle, or sounds into digital signals for transmission. The key idea is that encoding changes the representation, not the meaning, of the data.
Learn more about Encoding
, An Ansatz is a chosen form or structure of a quantum state (often parameterized) used as a starting point for algorithms like the Variational Quantum Eigensolver. It defines how qubits are entangled and rotated, and its parameters are optimized to approximate the solution to a problem. The quality of the Ansatz directly affects the accuracy and efficiency of the computation.
Learn more about Ansatz
, and In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually or ), with probabilities determined by the amplitudes of those states. After measurement, the qubit’s state becomes definite, destroying the original superposition.
Learn more about Measurement
define the hypothesis class, the optimization landscape, and the signal available for learning. In practice, it is the savvy selection of these components that makes the difference between a functioning algorithm and one that stalls.

  • Encoding of is a A **unitary operator** is a linear operator ( U ) on a complex vector space that satisfies ( U^\dagger U = UU^\dagger = I ), meaning it preserves inner products. In simpler terms, it preserves the **length** and **angle** between vectors—so it represents a **reversible, norm-preserving transformation**. In quantum mechanics, unitary operators describe the evolution of isolated systems because they conserve probability.
    Learn more about Unitary Operator
    (therefore ) that Encoding is the process of converting information from one form into another, usually so it can be stored, transmitted, or processed more efficiently. For example, text can be encoded into binary for computers to handle, or sounds into digital signals for transmission. The key idea is that encoding changes the representation, not the meaning, of the data.
    Learn more about Encoding
    the data value according to a A **Quantum Feature Map** is a process that converts classical input data into a **quantum state** using a parameterized quantum circuit. This transformation encodes data into the **high-dimensional Hilbert space** of a quantum system, allowing quantum algorithms to exploit complex correlations not easily captured classically. Essentially, it’s the quantum analogue of feature mapping in machine learning, used to make data more separable for classification or regression tasks.
    Learn more about Quantum Feature Map
    ("phi"). Different choices of correspond to different ways of embedding data into a A quantum state is the complete mathematical description of a quantum system, containing all the information needed to predict measurement outcomes. It’s usually represented by a wavefunction or a state vector in a Hilbert space. The state defines probabilities, not certainties, for observable quantities like position, momentum, or spin.
    Learn more about Quantum State
    , such as Angle encoding is a method of loading classical data into a quantum state by mapping data values to rotation angles of qubits (e.g., using quantum gates like Rx Gate, Ry Gate, or Rz Gate) Each feature of the data is represented as the angle of the quantum state vector’s rotation, which changes its probability amplitudes. This allows continuous classical values to be embedded in qQuantum states for use in quantum algorithms or quantum circuits.
    Learn more about Angle Encoding
    , Amplitude encoding represents classical data as the amplitudes of a quantum state's basis vectors. If you have a normalized data vector , it’s encoded into an -qubit state . This allows data values to be stored in only qubits, but preparing the quantum state can be computationally expensive.
    Learn more about Amplitude Encoding
    , or more elaborate A **Quantum Feature Map** is a process that converts classical input data into a **quantum state** using a parameterized quantum circuit. This transformation encodes data into the **high-dimensional Hilbert space** of a quantum system, allowing quantum algorithms to exploit complex correlations not easily captured classically. Essentially, it’s the quantum analogue of feature mapping in machine learning, used to make data more separable for classification or regression tasks.
    Learn more about Quantum Feature Map
    ). So means apply the unitary defined by encoding rule to input . The is not a variable like , but a tag to remind you how the data is being encoded.
    Learn more about
    : injects classical data or problem structures into a A quantum state is the complete mathematical description of a quantum system, containing all the information needed to predict measurement outcomes. It’s usually represented by a wavefunction or a state vector in a Hilbert space. The state defines probabilities, not certainties, for observable quantities like position, momentum, or spin.
    Learn more about Quantum State
    For example, in Quantum Machine Learning is the field of research that combines principles from quantum computing with traditional machine learning to solve complex problems more efficiently than classical approaches.
    Learn more about Quantum Machine Learning
    , a A **Quantum Feature Map** is a process that converts classical input data into a **quantum state** using a parameterized quantum circuit. This transformation encodes data into the **high-dimensional Hilbert space** of a quantum system, allowing quantum algorithms to exploit complex correlations not easily captured classically. Essentially, it’s the quantum analogue of feature mapping in machine learning, used to make data more separable for classification or regression tasks.
    Learn more about Quantum Feature Map
    encodes inputs into Amplitude encoding represents classical data as the amplitudes of a quantum state's basis vectors. If you have a normalized data vector , it’s encoded into an -qubit state . This allows data values to be stored in only qubits, but preparing the quantum state can be computationally expensive.
    Learn more about Amplitude Encoding
    or Phase encoding in quantum computing stores information in the *phase* of a qubit’s quantum state rather than its amplitude. The qubit’s phase determines how it interferes with other states during computation, enabling quantum algorithms to exploit interference for speedups. This is used in algorithms like Quantum Fourier Transform, where phase differences represent encoded data or computational results.
    Learn more about Phase Encoding
    ; in chemistry, a The Hamiltonian operator () in quantum mechanics represents the total energy of a system — both kinetic and potential. It acts on a wavefunction to determine how the system evolves over time, according to the Schrödinger equation. Mathematically, , where is the kinetic energy operator and is the potential energy operator.
    Learn more about Hamiltonian Operator
    is encoded into the A quantum circuit is a sequence of quantum gates applied to qubits, representing the operations in a quantum computation. Each gate changes the qubits’ state using quantum mechanics principles like superposition and entanglement. The final qubit states, when measured, yield the circuit’s computational result probabilistically.
    Learn more about Quantum Circuit
    However, the concept is the same. This part encodes the problem we want to solve.
  • Ansatz : The trainable part of the A quantum circuit is a sequence of quantum gates applied to qubits, representing the operations in a quantum computation. Each gate changes the qubits’ state using quantum mechanics principles like superposition and entanglement. The final qubit states, when measured, yield the circuit’s computational result probabilistically.
    Learn more about Quantum Circuit
    , constructed from parameterized In quantum computing, a rotation operator is a unitary matrix that rotates a qubit’s state vector on the Bloch sphere by a specific angle around a chosen axis (X, Y, or Z). These are denoted ( R_x(\theta) ), ( R_y(\theta) ), and ( R_z(\theta) ), where ( \theta ) is the rotation angle. They generalize Pauli gates and are fundamental for creating arbitrary single-qubit operations.
    Learn more about Rotation Operator
    and An **entanglement operator** is a quantum operation (a unitary or measurement-based transformation) that creates or modifies **quantum entanglement** between particles or subsystems. It acts on multiple qubits so their states become correlated in a way that can’t be described independently. Common examples include two-qubit gates like the **CNOT** or **CZ** gates, which generate entangled Bell states from separable inputs.
    Learn more about Entanglement Operator
    . This is the space in which Optimization is the process of finding the best possible solution to a problem within given constraints. It involves adjusting variables to minimize or maximize an objective function, such as cost, time, or efficiency. In simple terms, it’s about achieving the most effective outcome with the least waste or effort.
    Learn more about Optimization
    takes place, analogous to the architecture of a An artificial neural network is a computational model of interconnected nodes inspired by biological neurons, used to approximate functions and recognize patterns.
    Learn more about Neural Network
    whose weights describes the solution.
  • Measurement : The In quantum computing, an **observable** is a physical quantity (like energy, spin, or position) that can be **measured** from a quantum state. Mathematically, it’s represented by a **Hermitian operator**, whose eigenvalues correspond to the possible measurement outcomes. When you measure an observable, the quantum state **collapses** into one of its eigenstates, yielding one of those eigenvalues as the result.
    Learn more about Observable
    that defines the learning signal. In classification, it could be a A Pauli operator is one of three 2×2 complex matrices — **σₓ, σᵧ, σ_z** — that represent the basic quantum spin operations on a single qubit. They correspond to rotations or measurements along the x, y, and z axes of the Bloch sphere. Together with the identity matrix, they form a basis for all single-qubit operations in quantum mechanics.
    Learn more about Pauli Operator
    mapped to labels.

The complete prediction takes the form of an The expectation value is the average result you'd get if you repeated a measurement of a quantity many times under identical conditions. Mathematically, it’s the weighted average of all possible outcomes, where each outcome is weighted by its probability. In quantum mechanics, it represents the average value of an observable calculated from the wavefunction.
Learn more about Expectation Value
as shown in the ?.

Figure 3 Variational quantum machine learning prediction

Here, is a basis state.
Learn more about
is the reference state, which consists exclusively of zeros. is a A **unitary operator** is a linear operator ( U ) on a complex vector space that satisfies ( U^\dagger U = UU^\dagger = I ), meaning it preserves inner products. In simpler terms, it preserves the **length** and **angle** between vectors—so it represents a **reversible, norm-preserving transformation**. In quantum mechanics, unitary operators describe the evolution of isolated systems because they conserve probability.
Learn more about Unitary Operator
(therefore ) that Encoding is the process of converting information from one form into another, usually so it can be stored, transmitted, or processed more efficiently. For example, text can be encoded into binary for computers to handle, or sounds into digital signals for transmission. The key idea is that encoding changes the representation, not the meaning, of the data.
Learn more about Encoding
the data value according to a A **Quantum Feature Map** is a process that converts classical input data into a **quantum state** using a parameterized quantum circuit. This transformation encodes data into the **high-dimensional Hilbert space** of a quantum system, allowing quantum algorithms to exploit complex correlations not easily captured classically. Essentially, it’s the quantum analogue of feature mapping in machine learning, used to make data more separable for classification or regression tasks.
Learn more about Quantum Feature Map
("phi"). Different choices of correspond to different ways of embedding data into a A quantum state is the complete mathematical description of a quantum system, containing all the information needed to predict measurement outcomes. It’s usually represented by a wavefunction or a state vector in a Hilbert space. The state defines probabilities, not certainties, for observable quantities like position, momentum, or spin.
Learn more about Quantum State
, such as Angle encoding is a method of loading classical data into a quantum state by mapping data values to rotation angles of qubits (e.g., using quantum gates like Rx Gate, Ry Gate, or Rz Gate) Each feature of the data is represented as the angle of the quantum state vector’s rotation, which changes its probability amplitudes. This allows continuous classical values to be embedded in qQuantum states for use in quantum algorithms or quantum circuits.
Learn more about Angle Encoding
, Amplitude encoding represents classical data as the amplitudes of a quantum state's basis vectors. If you have a normalized data vector , it’s encoded into an -qubit state . This allows data values to be stored in only qubits, but preparing the quantum state can be computationally expensive.
Learn more about Amplitude Encoding
, or more elaborate A **Quantum Feature Map** is a process that converts classical input data into a **quantum state** using a parameterized quantum circuit. This transformation encodes data into the **high-dimensional Hilbert space** of a quantum system, allowing quantum algorithms to exploit complex correlations not easily captured classically. Essentially, it’s the quantum analogue of feature mapping in machine learning, used to make data more separable for classification or regression tasks.
Learn more about Quantum Feature Map
). So means apply the unitary defined by encoding rule to input . The is not a variable like , but a tag to remind you how the data is being encoded.
Learn more about
is the encoding that prepares a data-dependent state. is the trainable A **Parameterized Quantum Circuit (PQC)** is a quantum circuit where certain gate operations depend on adjustable parameters—typically real numbers representing rotation angles. These parameters are tuned (often by classical optimization) to perform a specific task, such as minimizing a cost function. PQCs are central to **variational quantum algorithms**, where quantum computation provides state preparation and measurement, and a classical computer optimizes the parameters.
Learn more about Parameterized Quantum Circuit
. And is the selected In quantum computing, an **observable** is a physical quantity (like energy, spin, or position) that can be **measured** from a quantum state. Mathematically, it’s represented by a **Hermitian operator**, whose eigenvalues correspond to the possible measurement outcomes. When you measure an observable, the quantum state **collapses** into one of its eigenstates, yielding one of those eigenvalues as the result.
Learn more about Observable
. The full Bra–ket notation is a compact way to describe quantum states and their inner products. A **ket** (|ψ⟩) represents a column vector describing a quantum state, while a **bra** (⟨φ|) represents its conjugate transpose (a row vector). The inner product ⟨φ|ψ⟩ gives a complex number (like an overlap or probability amplitude), and the outer product |ψ⟩⟨φ| gives an operator.
Learn more about Bra Ket
means that we average the measurement result over many runs. The In mathematics, the adjoint of a matrix (or operator) is its conjugate transpose: take the transpose and then replace each entry with its conjugate. For a matrix , the adjoint is written ). It generalizes the transpose to complex spaces and is central in defining Hermitian and unitary operators.
Learn more about Adjoint
occur because an The expectation value is the average result you'd get if you repeated a measurement of a quantity many times under identical conditions. Mathematically, it’s the weighted average of all possible outcomes, where each outcome is weighted by its probability. In quantum mechanics, it represents the average value of an observable calculated from the wavefunction.
Learn more about Expectation Value
in Linear algebra is the branch of mathematics that studies vectors, vector spaces, and linear transformations between them. It provides tools for solving systems of linear equations and understanding geometric operations like rotations, projections, and scaling. Its core objects—matrices and vectors—form the basis for much of modern computation, physics, and machine learning.
Learn more about Linear Algebra
is an An inner product is a mathematical operation that takes two vectors and returns a single number measuring how similar or aligned they are. In Euclidean space, it’s the sum of the products of corresponding components (e.g., (a \cdot b = a_1b_1 + a_2b_2 + \dots + a_nb_n)). It generalizes the dot product and defines geometric concepts like **length** and **angle** in vector spaces.
Learn more about Inner Product

Let's make this more practical and implement a variational Quantum Machine Learning algorithm with Qiskit is an open-source Python framework for programming and simulating quantum computers. It lets users create quantum circuits, run them on real quantum hardware or simulators, and analyze the results. Essentially, it bridges high-level quantum algorithms with low-level hardware execution.
Learn more about Qiskit
.

We begin with some preparations as depicted in ?. To do this, we all the functions that we will use from other modules.

simple-vqa.py
1
2
3
4
5
6
7
8
import numpy as np
from qiskit import QuantumCircuit
from qiskit.quantum_info import SparsePauliOp
from qiskit_aer.primitives import EstimatorV2 as Estimator
 
estimator = Estimator()
observable = SparsePauliOp.from_list([("Z", 1.0)])
target = 0.0
Listing 1 Preparation for a simple variational quantum machine learning algorithm
    We also initialize instances of classes that we will use in our example.
  1. We . This creates the EstimatorV2 primitive from Qiskit Aer is a high-performance simulator framework for quantum circuits within Qiskit. It lets users run and test quantum algorithms on classical hardware by accurately emulating noise, decoherence, and other quantum effects. This allows developers to validate and optimize quantum programs before executing them on real quantum computers.
    Learn more about Qiskit Aer
    . You use it to calculate The expectation value is the average result you'd get if you repeated a measurement of a quantity many times under identical conditions. Mathematically, it’s the weighted average of all possible outcomes, where each outcome is weighted by its probability. In quantum mechanics, it represents the average value of an observable calculated from the wavefunction.
    Learn more about Expectation Value
    for (A quantum circuit is a sequence of quantum gates applied to qubits, representing the operations in a quantum computation. Each gate changes the qubits’ state using quantum mechanics principles like superposition and entanglement. The final qubit states, when measured, yield the circuit’s computational result probabilistically.
    Learn more about Quantum Circuit
    , In quantum computing, an **observable** is a physical quantity (like energy, spin, or position) that can be **measured** from a quantum state. Mathematically, it’s represented by a **Hermitian operator**, whose eigenvalues correspond to the possible measurement outcomes. When you measure an observable, the quantum state **collapses** into one of its eigenstates, yielding one of those eigenvalues as the result.
    Learn more about Observable
    ) pairs.
  2. We . This creates the A Hermitian matrix (or operator) is one that equals its own conjugate transpose — mathematically, . This means each element satisfies . Hermitian matrices always have real eigenvalues and orthogonal eigenvectors, which makes them central in quantum mechanics and linear algebra.
    Learn more about Hermitian Matrix
    . In practice, this example means: Measure the one A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
    Learn more about Quantum Bit
    we have in the basis and assign the An eigenvalue is a number that indicates how much a linear transformation stretches or compresses a vector that doesn’t change direction under that transformation (called an eigenvector). Mathematically, it satisfies ( A v = \lambda v ), where ( A ) is a square matrix, ( v ) is the eigenvector, and ( \lambda ) is the eigenvalue. In essence, it measures the scaling factor applied to certain special directions of a transformation.
    Learn more about Eigenvalue
    that correspond to A **basis state** in quantum computing is one of the fundamental states that form the building blocks of a quantum system’s state space. For a single qubit, the basis states are (|0⟩) and (|1⟩); any other qubit state is a superposition of these. In systems with multiple qubits, basis states are all possible combinations of 0s and 1s (e.g., (|00⟩, |01⟩, |10⟩, |11⟩)), forming an orthonormal basis for the system’s Hilbert space.
    Learn more about Basis State
    . So, we assign to is a basis state.
    Learn more about
    and to is a basis state.
    Learn more about
    .
  3. We target = 0.0. Accordingly, the Optimization is the process of finding the best possible solution to a problem within given constraints. It involves adjusting variables to minimize or maximize an objective function, such as cost, time, or efficiency. In simple terms, it’s about achieving the most effective outcome with the least waste or effort.
    Learn more about Optimization
    attempts to bring to . That means, it moves the A quantum state vector is a mathematical object (usually denoted |ψ⟩) that fully describes the state of a quantum system. Its components give the probability amplitudes for finding the system in each possible basis state. The squared magnitude of each component gives the probability of measuring that corresponding outcome.
    Learn more about Quantum State Vector
    to the equator of the The Bloch sphere is a geometric representation of a single qubit’s quantum state as a point on or inside a unit sphere. The north and south poles represent the classical states |0⟩ and |1⟩, while any other point corresponds to a superposition of them. Its position encodes the qubit’s relative phase and probability amplitudes, making it a visual tool for understanding quantum state evolution.
    Learn more about Bloch Sphere
    (relative to the -axis. When you change the target value, the Optimization is the process of finding the best possible solution to a problem within given constraints. It involves adjusting variables to minimize or maximize an objective function, such as cost, time, or efficiency. In simple terms, it’s about achieving the most effective outcome with the least waste or effort.
    Learn more about Optimization
    will pursue this new target value. For instance, target=1 pushes toward is a basis state.
    Learn more about
    and target=-1 pushes toward is a basis state.
    Learn more about
    .

Qiskit Primitives

The next ? depicts the main Machine Learning is an approach on solving problems by deriving the rules from data instead of explicitly programming.
Learn more about Machine Learning
. But before we start this loop, we initialize the Optimization is the process of finding the best possible solution to a problem within given constraints. It involves adjusting variables to minimize or maximize an objective function, such as cost, time, or efficiency. In simple terms, it’s about achieving the most effective outcome with the least waste or effort.
Learn more about Optimization
with a (guessed) starting parameter , the , a within which we accept results as good enough, and the from evaluating the cost function at the starting parameter value.

simple-vqa.py
1
2
3
4
5
6
7
8
9
10
11
12
13
theta = 0.3
max_iters = 100
tol = 1e-4
prev_loss = cost(theta)
 
for k in range(max_iters):
theta = spsa_update(theta, k)
curr_loss = cost(theta)
if abs(prev_loss - curr_loss) < tol:
break
prev_loss = curr_loss
 
print(f"Final theta: {theta:.4f}, final cost: {curr_loss:.6f}")
Listing 2 The main machine learning loop
  1. Each iteration starts by with the result we obtain from calling the function spsa_update(theta, k), which applies a stochastic approximation step potentially using gradient estimates affected by the .
  2. Then, we using the cost function at the new theta.
  3. The algorithm then , measured as the absolute difference between the previous loss and current loss, is below the tolerance threshold tol. If so, it breaks the loop early, indicating convergence.
  4. If not converged, the to be used in the next iteration's comparison.

In this main feedback loop, we use two functions we have not yet defined: and

? shows the implementation of the spsa_update function that performs the classical Simultaneous Perturbation Stochastic Approximation (SPSA) is an optimization method that estimates the gradient of an objective function using only two function evaluations per iteration, regardless of the problem’s dimension. It does this by randomly perturbing all parameters simultaneously and using the difference in the resulting function values to approximate the gradient. SPSA is efficient for noisy or high-dimensional problems where computing exact or finite-difference gradients is costly.
Learn more about Simultaneous Perturbation Stochastic Approximation
Optimization is the process of finding the best possible solution to a problem within given constraints. It involves adjusting variables to minimize or maximize an objective function, such as cost, time, or efficiency. In simple terms, it’s about achieving the most effective outcome with the least waste or effort.
Learn more about Optimization
.

simple-vqa.py
1
2
3
4
5
6
7
8
9
def spsa_update(theta: float, k: int, a0=0.1, c0=0.1) -> float:
"""Classical optimizer step (SPSA-like)."""
a_k = a0 / (k + 1) ** 0.101
c_k = c0 / (k + 1) ** 0.102
delta = 1 if np.random.rand() < 0.5 else -1
loss_plus = cost(theta + c_k * delta)
loss_minus = cost(theta - c_k * delta)
ghat = (loss_plus - loss_minus) / (2 * c_k * delta)
return theta - a_k * ghat
Listing 3 Classical SPSA-like parameter update with stochastic gradient approximation

This optimizer the result of the cost function at slightly around theta. Here, the decays with the iteration count kto refine the approximation over time.

The difference quotient estimates the , which is used to update theta by stepping opposite to the gradient scaled by the that also decays slightly with k. Finally, we the updated theta parameter .

Let's now look at the code of the cost function in ?.

simple-vqa.py
1
2
3
def cost(theta: float) -> float:
ev = measure_expectation(theta)
return (ev - target) ** 2 # simple squared-error cost
Listing 4 Cost function computing squared error from measure_expectation and target

This function evaluates the quality of the by measuring the expectation value via and comparing it to the predefined target.

The cost is computed as the squared error between the measured value and target, forming a simple loss landscape guiding the optimizer toward minimizing this difference.

So far, all the code we have seen works in a purely classical way. This now changes with the calculation of the The expectation value is the average result you'd get if you repeated a measurement of a quantity many times under identical conditions. Mathematically, it’s the weighted average of all possible outcomes, where each outcome is weighted by its probability. In quantum mechanics, it represents the average value of an observable calculated from the wavefunction.
Learn more about Expectation Value
depicted in ?.

simple-vqa.py
1
2
3
4
5
6
7
def measure_expectation(theta: float) -> float:
"""Measure the observable to get an expectation value."""
qc = build_ansatz(theta)
# V2 API: (circuit, observable, parameter_values), no free Parameters, so [] is fine
result = estimator.run([(qc, observable, [])]).result()
evs = np.asarray(result[0].data.evs)
return float(np.atleast_1d(evs).ravel()[0])
Listing 5 Quantum circuit execution and measurement using the Estimator API to obtain expectation value
  1. The function takes a single parameter theta and passes it to a we create in the .
  2. We use the Estimator instance with a tuple containing the circuit, the observable, and an empty parameter list corresponding to no free parameters, as highlighted in to .
  3. We extract the and coerce the batch of expectation values that we return.

? depicts the final missing piece of our variational quantum machine learning algorithm: the An Ansatz is a chosen form or structure of a quantum state (often parameterized) used as a starting point for algorithms like the Variational Quantum Eigensolver. It defines how qubits are entangled and rotated, and its parameters are optimized to approximate the solution to a problem. The quality of the Ansatz directly affects the accuracy and efficiency of the computation.
Learn more about Ansatz
.

simple-vqa.py
1
2
3
4
5
def build_ansatz(theta: float) -> QuantumCircuit:
"""Prepare a parameterized state |ψ(θ)⟩."""
qc = QuantumCircuit(1)
qc.ry(theta, 0)
return qc
Listing 6 Function to create the ansatz

The build_ansatz function the simplest imaginable An Ansatz is a chosen form or structure of a quantum state (often parameterized) used as a starting point for algorithms like the Variational Quantum Eigensolver. It defines how qubits are entangled and rotated, and its parameters are optimized to approximate the solution to a problem. The quality of the Ansatz directly affects the accuracy and efficiency of the computation.
Learn more about Ansatz
: a A quantum circuit is a sequence of quantum gates applied to qubits, representing the operations in a quantum computation. Each gate changes the qubits’ state using quantum mechanics principles like superposition and entanglement. The final qubit states, when measured, yield the circuit’s computational result probabilistically.
Learn more about Quantum Circuit
with a single A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit
. It applies the In quantum computing, a rotation operator is a unitary matrix that rotates a qubit’s state vector on the Bloch sphere by a specific angle around a chosen axis (X, Y, or Z). These are denoted ( R_x(\theta) ), ( R_y(\theta) ), and ( R_z(\theta) ), where ( \theta ) is the rotation angle. They generalize Pauli gates and are fundamental for creating arbitrary single-qubit operations.
Learn more about Rotation Operator
and therefore turns the A quantum state vector is a mathematical object (usually denoted |ψ⟩) that fully describes the state of a quantum system. Its components give the probability amplitudes for finding the system in each possible basis state. The squared magnitude of each component gives the probability of measuring that corresponding outcome.
Learn more about Quantum State Vector
around the -axis by the angle (theta) that the function takes as a .

This simple An Ansatz is a chosen form or structure of a quantum state (often parameterized) used as a starting point for algorithms like the Variational Quantum Eigensolver. It defines how qubits are entangled and rotated, and its parameters are optimized to approximate the solution to a problem. The quality of the Ansatz directly affects the accuracy and efficiency of the computation.
Learn more about Ansatz
only explores A quantum state is the complete mathematical description of a quantum system, containing all the information needed to predict measurement outcomes. It’s usually represented by a wavefunction or a state vector in a Hilbert space. The state defines probabilities, not certainties, for observable quantities like position, momentum, or spin.
Learn more about Quantum State
around the -axis of the The Bloch sphere is a geometric representation of a single qubit’s quantum state as a point on or inside a unit sphere. The north and south poles represent the classical states |0⟩ and |1⟩, while any other point corresponds to a superposition of them. Its position encodes the qubit’s relative phase and probability amplitudes, making it a visual tool for understanding quantum state evolution.
Learn more about Bloch Sphere
. This is the vertical circle in the -plane as shown in ?.

Figure 4 States reachable by the RY-operator

After the minimal code demo with a single A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit
, a single , and a -measurement, we've seen the mechanics but also the limitation: a very simple An Ansatz is a chosen form or structure of a quantum state (often parameterized) used as a starting point for algorithms like the Variational Quantum Eigensolver. It defines how qubits are entangled and rotated, and its parameters are optimized to approximate the solution to a problem. The quality of the Ansatz directly affects the accuracy and efficiency of the computation.
Learn more about Ansatz
is easy to train yet too weak for most problems. The next step is to scale carefully because the pitfalls are waiting for us. Nevertheless, The barren plateau problem in quantum computing refers to regions in a quantum circuit’s parameter space where the **gradient of the cost function becomes exponentially small** as the number of qubits increases. This makes training variational quantum algorithms (like VQEs or QNNs) extremely difficult because optimization algorithms receive almost no useful signal to guide updates. It’s primarily caused by random circuit initialization and high circuit depth, leading to near-random output states.
Learn more about Barren Plateau
Noise
Learn more about Noise
and over-parameterization are manageable with disciplined design:

  • Problem-inspired ansätze: mirror the structure of the objective (chemistry Hamiltonians, graph constraints). This preserves gradient signal and reduces wasted parameters.
  • Shallow designs: keep depth minimal to limit noise accumulation and avoid flat landscapes while still capturing key correlations.
  • Initialization near identity: start close to the reference circuit so gradients don't vanish at step zero.
  • Geometry-aware optimization: use Stokes, J., 2020, Quantum, Vol. 4, pp. 269.
  • Error mitigation: apply lightweight post-processing (e.g. Zero Noise Extrapolation (ZNE) is an error mitigation technique where a quantum circuit is run multiple times at different, artificially increased noise levels. The results are then extrapolated back to the “zero-noise” limit using a mathematical fit (often linear or polynomial). This provides an estimate of what the circuit’s outcome would be if there were no hardware noise, without requiring full quantum error correction.
    Learn more about Zero Noise Extrapolation
    ) to curb bias without full fault tolerance.

These are the exact fronts where Quantum Machine Learning is the field of research that combines principles from quantum computing with traditional machine learning to solve complex problems more efficiently than classical approaches.
Learn more about Quantum Machine Learning
research is concentrated today.