When we talk about variational circuits, we look at a hybrid structure where we see a quantum circuit and quantum measurements which are trained by a classical optimization algorithm. Some examples are Variational Quantum Eigensolver, Quantum Approximate Optimization Algorithm and some aspects of Quantum Machine Learning.
Briefly we have three ingredients for the quantum structure :
- An initial fixed quantum state.
- A parametrized quantum circuit which is also known as ansatz with some free parameters
.\theta - Measurement of an observable at the output.
Typically the expectation value represents the output of the objective function which is given by the following equation :f(\theta)
$f(\theta) = \left\langle \psi \middle | U_G^{\dagger}(\theta) A U_G(\theta) \middle| \psi \right\rangle $
where
Some of the promising approaches for the classical optimization include gradient descent, stochastic gradient descent, ADAM when the input data set is large. Another promising approach for calculating the gradient of the quantum parametrized circuits is the parameter shift rule.
Parameter-shift rule
The parameter-shift rule can be easily applied to quantum circuits with the generator gates having 2 unique eigenvalues. Parameter shift rule states that if we have a generator gate G with 2 unique eigenvalues, we can write the derivative of the expectation value of the quantum circuit as:
What do you mean by an operator being idempotent?
Let say we have an operator A which is both hermitian and unitary, then AA =
Parameter-shift rule when the generator gate is both unitary and hermitian :
$\frac{d}{d\theta} f(\theta) = \left \langle \psi \middle | G U_G^{\dagger} (\theta) A U_G(\theta) \middle | \psi \right\rangle - \left \langle \psi \middle | U_G^{\dagger} (\theta) A G U_G(\theta) \middle | \psi \right\rangle $
Using the commutator formula we can write the above as :
where [A , B] = AB-BA.
In order to convert the above commutator formula to unitary operator format we use the following mathematical identity :
$ [A , B] = -i(U_i^{\dagger}(\frac{\pi}{2})BU_i(\frac{\pi}{2}) - U_i^{\dagger} (\frac{-\pi}{2})BU_i(\frac{-\pi}{2}))$
Using the above identity in the derivative equation gives us :
$\frac{d}{d\theta} = \left \langle \psi \middle | U_G^{\dagger} (\theta + \frac{\pi}{2}) A U_G(\theta + \frac{\pi}{2}) \middle | \psi \right\rangle - \left \langle \psi \middle | U_G^{\dagger} (\theta - \frac{\pi}{2}) A U_G(\theta - \frac{\pi}{2}) \middle | \psi \right\rangle $
=
The above gets a bit complex when the generator gate isn't unitary but still has 2 unique eigenvalues. In such cases we introduce a shift constant r which is equivalent to
Thus we can write the unitary operator as:
A special case of the above is :
and again taking the derivative of
Using the derivative equation like we used before (using the product rule) and replacing the value of the above special case of the unitary operator in the derivative equation, we get the final parameter shift rule equation consisting of the the shift constant r as :
$\frac{d}{d\theta} f(\theta) = r\left \langle \psi \middle | U_G^{\dagger} (\theta + \frac{\pi}{4r}) A U_G(\theta + \frac{\pi}{4r}) \middle | \psi \right\rangle - \left \langle \psi \middle | U_G^{\dagger} (\theta - \frac{\pi}{4r}) A U_G(\theta - \frac{\pi}{4r}) \middle | \psi \right\rangle $
$ = r[f(\theta + \frac{\pi}{4r}) - f(\theta - \frac{\pi}{4r})]$
The value of the shift constant r here depends on the type of parametrizations. If we use
So here we see how to apply the parameter-shift rule to 1 qubit geenrator gates. In the case of two qubit generator gates we use gate decomposition to perform the same. We will be discussing that in the next part of the article.
References :