- Algorithms
HHL Algorithm (Harrow-Hassidim-Lloyd)
The HHL algorithm solves sparse linear systems Ax=b exponentially faster than classical methods under specific conditions, with applications in machine learning, fluid dynamics, and financial modeling.
The HHL algorithm, introduced by Aram Harrow, Avinatan Hassidim, and Seth Lloyd in 2009, solves a system of linear equations Ax = b for a sparse, well-conditioned matrix A. The circuit proceeds in three main stages. First, quantum phase estimation encodes the eigenvalues of A into a register of ancilla qubits. Second, a controlled rotation applies a function of those eigenvalues to invert the matrix, effectively computing 1/lambda for each eigenvalue lambda. Third, uncomputation (reverse phase estimation) cleans up the ancilla register, leaving the solution state |x> encoded in the amplitudes of a quantum register. The output is not the full solution vector but a quantum state from which properties of x can be sampled or estimated.
The exponential speedup of HHL is real but conditional on three demanding requirements. The matrix A must be sparse (few nonzero entries per row) and well-conditioned (small ratio of largest to smallest eigenvalue, called the condition number kappa). An efficient quantum RAM (QRAM) must load the right-hand side vector b into superposition in time polylogarithmic in its dimension. And the quantity of interest must be extractable as an expectation value of some observable on |x> rather than as the full classical solution vector. When all three conditions hold, HHL achieves an O(log(N) kappa^2) query complexity versus the classical O(N kappa) of conjugate gradient, an exponential gap in N.
In 2018 Ewin Tang showed that classical algorithms can match HHL’s performance for sampling-based outputs when given access to analogous classical data structures, a result called dequantization. Tang’s SampledLinearSystem algorithm showed that the apparent exponential advantage collapses for many practical machine-learning applications that only need to sample from the solution distribution. This does not eliminate HHL’s value, but it raises the bar: genuine quantum advantage requires either full solution readout (not just sampling) or problem structures that classical sampling cannot exploit. Identifying such structures remains an active research area.
Despite these caveats, HHL has been implemented on real hardware and explored for industrial use cases. TotalEnergies and IBM collaborated on applying quantum linear solvers to reservoir simulation in oil and gas, where fluid flow equations produce large sparse linear systems at every timestep. BP has similarly studied quantum linear algebra for seismic imaging. Short-depth variational variants such as the Variational Quantum Linear Solver (VQLS) have been demonstrated on small NISQ devices, trading the full exponential speedup for near-term practicality. Fault-tolerant implementations at industrially relevant scales remain a long-term target requiring millions of physical qubits due to the overhead of phase estimation and QRAM.