Parameter-shift rule #
A variational (parameterized) quantum model has a cost C(θ) = ⟨ψ| U(θ)† O U(θ) |ψ⟩
that is optimized over the parameters θ. When θ enters through a single Pauli
rotation gate, C is a frequency-1 trigonometric polynomial in θ, and its exact
analytic gradient is obtained from two shifted evaluations — the parameter-shift
rule C'(θ) = (C(θ + π/2) − C(θ − π/2)) / 2.
This module records the parameter-shift rule abstractly (ParamShiftModel), and
instantiates it on a concrete single-qubit R_Y(θ) ansatz with observable Z,
whose cost is cos θ.
Sources: Schuld et al. (2019), Evaluating analytic gradients on quantum hardware; Wierichs et al. (2022), General parameter-shift rules for quantum gradients; Farhi, Goldstone, Gutmann (2014), A Quantum Approximate Optimization Algorithm.
Main results #
LeanPool.LeanQuantumAlg.ParamShiftModel/ParamShiftModel.parameter_shift— the parameter-shift rule for any frequency-1 trigonometric cost.LeanPool.LeanQuantumAlg.varCost— the single-qubitR_Y(θ)variational cost.LeanPool.LeanQuantumAlg.varCost_ket0_Z— theR_Y/Z/|0⟩cost equalscos θ.LeanPool.LeanQuantumAlg.varCost_ket0_Z_parameter_shift— the parameter-shift rule for it.
A single-parameter variational cost whose dependence on the parameter is a
frequency-1 trigonometric polynomial a + b cos θ + c sin θ — the structure that
makes the parameter-shift rule exact. A parameterized-circuit cost built from a
single Pauli rotation gate has this form.
The cost function.
- a : ℝ
Constant Fourier coefficient.
- b : ℝ
Cosine Fourier coefficient.
- c : ℝ
Sine Fourier coefficient.
The cost is a frequency-1 trigonometric polynomial.
Instances For
The single-qubit R_Y(θ) variational cost with observable O on input ψ:
C(θ) = ⟨ψ| R_Y(θ)† O R_Y(θ) |ψ⟩.
Equations
- QuantumAlg.varCost ψ O θ = ((QuantumAlg.rotY θ).apply ψ).expVal O
Instances For
R_Y(θ) |0⟩ = cos(θ/2) |0⟩ + sin(θ/2) |1⟩.
Inner product of two single-qubit states in the computational basis.
The R_Y(θ) ansatz cost with observable Z on |0⟩ equals cos θ.
A concrete variational model: the R_Y / Z / |0⟩ cost cos θ.
Equations
- QuantumAlg.rotYZModel = { cost := QuantumAlg.varCost QuantumAlg.PureState.ket0 QuantumAlg.Gate.Z.op, a := 0, b := 1, c := 0, trig := ⋯ }
Instances For
Public supporting theorem: the quantum-free trigonometric identity.
Public supporting theorem: the concrete R_Y / Z / |0⟩ cost.
Public supporting theorem: parameter shift for the concrete R_Y / Z / |0⟩ cost.