Quantum Support Vector Machine

Research
Introduced by
Patrick Rebentrost, Masoud Mohseni, and Seth Lloyd
Year
2014
Type
Machine learning algorithm
Family
Quantum Machine Learning

What does it do?

Quantum Support Vector Machine (QSVM) is a quantum machine learning method in which a quantum circuit evaluates the kernel between data points and a classical SVM solver finds the separating hyperplane.

Rebentrost, Mohseni and Lloyd proposed a quantum procedure for SVM training in 2014, and Havlíček et al. (2019) studied quantum-enhanced feature spaces for supervised learning, which underlies the kernel-based variant widely discussed today. The practicality of each variant on current devices is a separate question.

The intuition behind the method

A parameterised quantum circuit maps each classical data point to a quantum state, and the inner product between two such states defines a kernel value. The classical SVM uses only these kernel values, so the quantum device's role is to evaluate the kernel and the classical solver handles the optimisation. Whether this feature map separates the classes better than a classical kernel depends on the encoding and the data. The dimension of the quantum feature space alone does not guarantee that.

History

Rebentrost, Mohseni and Lloyd (2014) proposed a quantum algorithm for SVM classification in which the training kernel matrix is handled by quantum matrix exponentiation and inversion. Havlíček et al. (2019) studied quantum-enhanced feature spaces for supervised learning, which led to the kernel-estimation form of QSVM that is now common in discussions of near-term devices. Whether quantum kernels give an advantage on real-world datasets remains unresolved.

When to use it

Choose QSVM for binary classification when a quantum feature map is a deliberate hypothesis, for example when the input data are themselves quantum states or when a specific encoding is motivated by the problem. It also requires access to a quantum processor or a simulator and a training set small enough that the required kernel evaluations are feasible. Do not choose QSVM when a classical SVM with standard kernels already reaches the required accuracy, since no general advantage has been established on realistic datasets. Avoid it when the data cannot be encoded efficiently or when quantum access is unavailable.

Limitations and considerations

  • The exponential speed-up in the 2014 analysis is obtained in cases where classical sampling algorithms require polynomial time. It holds only within that algorithm's assumptions, not for typical datasets.
  • The 2014 logarithmic complexity belongs to the state-based algorithm (matrix exponentiation of the kernel matrix). The kernel-estimation variant has a different cost model: it needs estimates of all pairwise overlaps, so the number of quantum evaluations grows quadratically with the training set size, and each estimate carries shot noise.
  • Finite measurement shots give each kernel entry statistical error, which propagates into the SVM solution.
  • Hardware noise degrades the overlaps that define the kernel, which can reduce the information the kernel matrix carries about the classes.
  • Efficient loading of classical data into quantum states (efficient state preparation and data access) is a central assumption of the speed-up analyses. It is not free in practice and is not available on current hardware.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • The feature map is isolated in the kernel, so the classical SVM solver and its regularisation can be used without modification.
  • In the kernel-estimation variant, only the kernel matrix needs quantum evaluation, which allows a hybrid quantum-classical workflow.
  • The 2014 algorithm, which uses nonsparse matrix exponentiation to invert the kernel matrix, has complexity logarithmic in vector dimension and in the number of training examples, under the assumptions of that analysis.
  • The approach separates the design of the quantum feature map from the choice of classical optimiser, so each part can be studied separately.

Applications

  • Classification of quantum data, such as states produced by quantum experiments or quantum simulations.
  • Benchmarking quantum feature maps against classical kernels on small supervised learning tasks.
  • Proof-of-concept studies of quantum-enhanced classification run on quantum hardware or simulators.

How it works

How it works

1

Encode each classical data point into a quantum state with a parameterised quantum circuit whose structure and parameters determine the feature map.

2

Estimate the kernel entries as overlaps ⟨ψ(x_i)|ψ(x_j)⟩ between pairs of encoded states, using a measurement-based procedure such as a SWAP test or by applying the inverse encoding circuit and measuring the return probability. Because the result comes from finitely many measurements, each kernel value carries statistical error.

3

Pass the estimated kernel matrix to a standard SVM solver, which finds the support vectors and dual coefficients by solving the quadratic programming problem. The classical step is unchanged once the kernel matrix is available.

4

Classify a new point by computing its quantum kernel values against the support vectors and evaluating the SVM decision function built from those values.

Common pitfalls

  • Treating the exponential speed-up from the 2014 analysis as evidence of an advantage for kernel estimation on present-day hardware.
  • Ignoring shot noise and hardware noise when reporting classification accuracy or kernel quality.
  • Comparing against a weakly tuned classical SVM; a classical SVM with a well-chosen kernel is the relevant baseline.
  • Choosing a highly expressive encoding without adequate regularisation, which can fit the training data without generalising.
  • Reporting results without accounting for the cost of state preparation and of the many kernel evaluations.

Frequently asked questions

What is a quantum kernel and how is it computed?

A quantum kernel is built from the inner product ⟨ψ(x_i)|ψ(x_j)⟩ between two data points encoded as quantum states; it is often used as the squared magnitude |⟨ψ(x_i)|ψ(x_j)⟩|². It is estimated from measurement statistics, for example with a SWAP test on an ancilla qubit or by applying the inverse encoding circuit and measuring the probability of returning to the initial state. Each kernel value therefore carries statistical error from finitely many measurements.

Can QSVM provide exponential speed-up?

The 2014 analysis by Rebentrost et al. reports an exponential speed-up in cases where classical sampling algorithms require polynomial time. It rests on its own assumptions, notably efficient quantum access to the training data and efficient state preparation, which are not available on current hardware. Whether a practical advantage exists for realistic datasets has not been established.

How is the feature encoding chosen?

Feature encoding is often problem-specific. Common choices include amplitude encoding (mapping data to quantum amplitudes) and angle encoding (mapping data to rotation angles). The design of the parameterised circuit strongly affects the resulting kernel and therefore the classifier.

What is the SWAP test and why is it used?

The SWAP test estimates the overlap of two quantum states. A controlled-SWAP operation acts between the two states, and an ancilla qubit is measured. The probability of one ancilla outcome depends on the squared overlap, which is extracted from measurement statistics.

How does QSVM compare to classical neural networks?

QSVM places the learning in a fixed quantum feature map and trains only the classical SVM, while neural networks learn their features during training. A QSVM could offer an advantage only if the quantum feature map separates the classes better than classical features, and this is difficult to guarantee in advance.

Related methods

Sources

  1. Rebentrost, P., Mohseni, M., Lloyd, S. (2014). Quantum support vector machine for big data classification. Physical Review Letters, 113, 130503.

    Open DOI reference
  2. Havlíček, V., Córcoles, A. D., Temme, K., et al. (2019). Supervised learning with quantum-enhanced feature spaces. Nature, 567, 209–212.

    Open DOI reference
  3. Liu, Y., Arunachalam, S., Temme, K. (2021). A rigorous and robust quantum speed-up in supervised machine learning. arXiv preprint arXiv:2010.07471.

    Open publication reference