Source-linked AI summary

Evaluating analytic gradients on quantum hardware

Maria Schuld, Ville Bergholm, Christian Gogolin, Josh Izaac, Nathan Killoran

arXiv:1811.11184v1quant-ph

TL;DR

Gradient-based optimization of parametrized quantum circuits requires expectation-value derivatives that can be evaluated on quantum hardware despite gate derivatives not generally being valid quantum gates. The paper derives parameter-shift rules and ancilla-assisted procedures for qubit and continuous-variable circuits, often preserving the original architecture and requiring only two expectation values. Its recipes extend parameter shifting to broader gate classes and provide efficient continuous-variable cases under stated circuit conditions.

  • Problem

    Hardware-compatible exact gradients are needed for quantum expectation values, but gate derivatives are not necessarily valid quantum gates and gradients may be classically intractable.

  • Method

    The paper derives hardware-compatible gradient rules using parameter shifts for suitable generators, ancilla-conditioned unitary decompositions for general gates, and recipes for continuous-variable circuits.

  • Results

    The derivatives can often use an architecture very similar or identical to the original circuit, and evaluating them requires only two expectation values.

  • Takeaways & Limitations

    Many qubit gradients can be obtained by running the original circuit twice with one parameter shifted, while more general cases use a single ancilla.

Abstract

from arXiv · show

An important application for near-term quantum computing lies in optimization tasks, with applications ranging from quantum chemistry and drug discovery to machine learning. In many settings --- most prominently in so-called parametrized or variational algorithms --- the objective function is a result of hybrid quantum-classical processing. To optimize the objective, it is useful to have access to exact gradients of quantum circuits with respect to gate parameters. This paper shows how gradients of expectation values of quantum measurements can be estimated using the same, or almost the same, architecture that executes the original circuit. It generalizes previous results for qubit-based platforms, and proposes recipes for the computation of gradients of continuous-variable circuits. Interestingly, in many important instances it is sufficient to run the original quantum circuit twice while shifting a single gate parameter to obtain the corresponding component of the gradient. More general cases can be solved by conditioning a single gate on an ancilla.

I. INTRODUCTION

Hybrid optimization combines classical and quantum processing, creating a need for hardware-compatible gradients of parametrized quantum circuits. The paper develops parameter-shift and ancilla-based rules, extending prior qubit results and addressing continuous-variable circuits.

  • Hybrid optimization combines classical and quantum nodes, with quantum nodes executing parametrized circuits whose gates have adjustable continuous parameters.Examples include variational eigensolvers, approximate optimization, autoencoders, feature embeddings, and classifiers.
  • Gradients are essential for gradient-descent optimization because quantum measurements are probabilistic, whereas observable expectation values vary smoothly with gate parameters.Expectation values are estimated by averaging measurement results and provide the differentiable quantities used to define quantum-computation gradients.
  • Computing gradients on quantum hardware is difficult because a gate derivative need not itself be a valid quantum gate, while the gradient may be classically intractable.The derivatives must therefore be expressed as combinations of hardware-implementable quantum operations.
  • For gates G = e^-iµσ with Pauli-product σ, the parameter-shift rule evaluates the original expectation twice after shifting one circuit parameter.This prior result motivates the paper’s broader hardware-compatible gradient recipes.
  • The paper extends parameter shifting to generators with at most two eigenvalues, handles general gates with one ancilla, and derives continuous-variable recipes.The continuous-variable rules are efficient under Gaussian-gate and observable-degree conditions, with limited non-Gaussian extensions.

II. COMPUTING QUANTUM GRADIENTS

The section frames quantum-gradient evaluation as a hardware problem: standard numerical and automatic differentiation approaches face device noise or inaccessible intermediate states. It then presents analytic rules whose measurements can often use the original circuit architecture and only two expectation values.

  • A variational circuit maps m gate parameters to an expectation value, although hardware estimates that value by repeatedly sampling and averaging measurements.Classical simulation can compute the function exactly up to numerical precision.
  • Finite-difference gradients can become infeasible on noisy near-term devices because measurement and device errors make numerical approximations inaccurate.This motivates analytic differentiation rules that operate directly on quantum hardware.
  • Automatic differentiation cannot efficiently reuse intermediate quantum derivatives because measuring intermediate quantum states would disturb the computation.Backpropagation remains usable in the larger hybrid computation, but not for efficiency gains on intermediate quantum steps.
  • The proposed strategy derives expressions for each expectation derivative whose components are measured on a quantum computer and combined classically.The paper applies this recipe to qubit-based and continuous-variable circuits.
  • Evaluating a derivative often uses a circuit architecture very similar or identical to that used for the original expectation.The differentiation rules are exact analytically, while finite noisy-hardware runs produce gradient estimates.
  • Two expectation values suffice to evaluate the derivative under the section’s stated strategy.This is one of the method’s principal hardware-efficiency properties.

III. GRADIENTS OF DISCRETE-VARIABLE CIRCUITS

For a parameter appearing in one gate, the circuit derivative follows from differentiating that gate within the surrounding unitary sequence. The resulting terms can be evaluated directly when suitable unitary combinations exist, or with an ancilla otherwise.

  • The circuit unitary is decomposed into single-parameter gates, and the product rule isolates the gate G(µ) affected by parameter µ.Writing U(θ) = V G(µ) W absorbs V into the observable and W into the input state.
  • The derivative of the expectation contains terms involving G and its gate derivative ∂µG, plus the Hermitian-conjugate contribution.This expression is the basis for constructing hardware-compatible evaluations.
  • When G ± ∂µG can be implemented as part of a unitary evolution, the derivative terms can be evaluated directly on quantum hardware.The paper identifies suitable gates and an ancilla-assisted method for other cases.

A. Parameter-shift rule for gates with generators with two distinct eigenvalues

For gates generated by Hermitian operators with at most two distinct eigenvalues, exact expectation-value derivatives can be obtained by shifting the gate parameter and evaluating the circuit at shifted settings. The rule covers many single-qubit and hardware-efficient gates, but not general multi-qubit generators with more than two eigenvalues.

  • Theorem and derivation: If the Hermitian generator has at most two distinct eigenvalues ±r, the paper derives an exact parameter-shift identity for the derivative.The derivation uses the resulting relation G^2 = r^2 1 to simplify the sine and cosine series of the gate.
  • Parameter-shift implementation: The derivative can be estimated with two additional quantum-device evaluations using shifted versions of the differentiated gate.The shifted evaluations place the gate at parameter offsets determined by the generator spectrum, yielding the parameter-shift rule.
  • Multiple occurrences: When a parameter occurs in multiple gates, the derivative is computed by shifting each affected gate separately and summing the results.This is an exact macroscopic-shift rule rather than a finite-difference approximation.
  • Applicable gates: The rule applies to one-qubit rotation generators and Pauli-linear generators because they have at most two unique eigenvalues.The paper also notes applicability to several hardware-efficient gates whose generators have at most two eigenvalues.
  • Scope boundary: General Pauli-based multi-qubit gates need not satisfy the two-eigenvalue condition; a microwave-controlled transmon gate, for example, has four eigenvalues.For such gates, other strategies are required to compute exact variational-circuit gradients.

B. Differentiation of general gates via linear combination of unitaries

General gates whose parameter derivatives are not directly implementable can be differentiated by coherently combining the original gate with unitary terms controlled by one ancilla.

  • Any finite-dimensional gate derivative can be decomposed into a linear combination of unitary matrices, enabling hardware-compatible evaluation with an ancilla.The decomposition requires controlled implementations of the original gate and derivative unitaries.
  • The coherent routine applies G and A on ancilla-conditioned branches between two Hadamards, producing sum or difference branches.Measuring the ancilla selects the corresponding branch, and both outcomes contribute to the final estimate.
  • The ancilla-conditioned expectation values provide the quantities needed to compute the derivative terms.The two branches correspond to expressions involving (G + A) and (G − A).
  • The measurement is not postselection with limited success probability because either ancilla result contributes to the estimate.
  • With K chosen as 2, the method requires estimating 2K expectation values and 2K ancilla probabilities, after finding the derivative decomposition.The decomposition is found once and is easy for few-qubit gates.
  • Coherent linear combinations generalize earlier classical decompositions tied to σz observables to arbitrary observables.

IV. GRADIENTS OF CONTINUOUS-VARIABLE CIRCUITS

For continuous-variable circuits, the paper develops gradient recipes for Gaussian gates followed only by Gaussian operations and measured with low-degree quadrature polynomials.

  • The CV parameter-shift strategy applies when a Gaussian gate is followed by Gaussian operations and the observable is a low-degree quadrature polynomial.
  • The derivation uses the Heisenberg picture, where the final observable is evolved backward through adjoint gates instead of evolving the state forward.The observables are represented as polynomials in quadrature operators.
  • Quadrature observables are expanded in an infinite-dimensional vector of monomials ordered by degree.

A. CV gates in the Heisenberg picture

In the Heisenberg picture, Gaussian gates act as finite-dimensional linear transformations on suitable quadrature-monomial subspaces, allowing their derivatives to be decomposed similarly.

  • Conjugating quadrature monomials by a gate acts as a linear transformation on the monomial vector.
  • Gaussian conjugation preserves the subspace spanned by zeroth- and first-degree monomials.
  • Higher-degree quadrature monomials can be handled as products of lower-degree monomials, extending the representation beyond first-degree observables.
  • Any n-mode Gaussian gate can therefore be represented by a (2n+1)×(2n+1) Heisenberg-picture matrix.
  • Derivatives of universal Gaussian gates decompose into two same-class matrix terms, giving CV derivative computations the same complexity as the qubit case.
  • For squeezing, the derivative is not itself a squeezing-gate representation but can be expressed as a linear combination of such representations.

B. Differentiating CV circuits

CV circuit derivatives follow from differentiating Heisenberg-picture gate matrices and applying the resulting linear combinations to Gaussian circuits under a clear non-Gaussian-gate boundary.

  • For first-degree quadrature observables, Gaussian-gate derivatives can be computed using the finite-dimensional Heisenberg matrix representation.
  • Table II summarizes parameter-shift rules for important Gaussian gates in a universal gate set, using single- and two-mode quadrature bases.
  • The Gaussian-gate parameter-shift rule expresses ∂µf as a linear combination of shifted evaluations, ∂µf = Σ_i γ_i f(µ + s_i).
  • The subcircuit before the differentiated gate may be arbitrary, provided no non-Gaussian gates lie between that gate and the observable.
  • Higher-degree observables are differentiated using the product rule and the factorization of monomials into lower-degree terms.

C. Non-Gaussian transformations

Non-Gaussian subcircuits can raise the observable’s degree, making analytic gradient decompositions more challenging and potentially less efficient.

  • Non-Gaussian transformations generally increase the degree of the final observable under Heisenberg conjugation.The transformed observable V†BV can have higher degree than B.
  • Multiple non-Gaussian gates can enlarge the Heisenberg-representation matrices according to their quantity and character.Each such gate can raise the observable’s degree.
  • Efficient gradient decomposition may remain possible with logarithmically few non-Gaussian gates that each raise quadrature degree by a bounded amount.Under these conditions, the gradient can potentially be decomposed into polynomially many component expectation values.

V. CONCLUSION

The paper presents hardware-compatible strategies for derivatives of variational-circuit expectation values. Qubit circuits often use parameter shifts, while other cases use an ancilla and derivative-gate decomposition.

  • The proposed strategies evaluate derivatives of quantum expectation values using the output of variational quantum circuits.They are designed to be compatible with quantum hardware.
  • For many qubit circuits, a simple parameter-shift rule uses the original circuit architecture.The derivative is obtained by shifting a gate parameter within the variational architecture.
  • Other cases use an ancilla together with a decomposition of the derivative of a gate.This extends the hardware-compatible approach beyond cases covered by the simple shift rule.
Loading 1811.11184v1…