QAOA tutorial - choosing circuit depth & removing inefficiencies

Hi! I just went through your QAOA tutorial. Very helpful! I have two questions that I’m grappling with:

  1. Looking at the circuit drawing for the approximate time evolution, it looks there are two Hadamard gates in row acting on qubit 0.

approximate%20circuit

Is that right? If so, then isn’t two Hadamards is equal to the identity? If so, then does PennyLane remove inefficiencies like this? I.e., if I create a circuit, can I get PennyLane to find and remove (or replace) inefficient gates? Just curious.

  1. The example (Minimum Covering Vertex) uses a depth of n = 2. In general, how do you select a depth value in QAOA?

Trial and error?
The largest value that your quantum computer allows without the errors getting too big due to large circuit depth?
The largest value that your optimization process can handle (i.e., the largest set of γ, α parameters that it can manage)?
Something else?

Thanks!
Damian

Hi, Damian_Pope-san.

As an ameteur, I try to ask the question #2.

It would be trial and error.
In actual devices, the meaningful number of QAOA layers is 2~3 shown in a Google’s paper. The reasons are gate error and short coherent time.

[2004.04197] Quantum Approximate Optimization of Non-Planar Graph Problems on a Planar Superconducting Processor (arxiv.org)

image

On the other hand, in simulations, the number of QAOA layers would be limited by CPU resources.
Moreover, if we use too many layers, we may face Barren plateaus problem, in which the opimization stop at local minimum.

Barren plateaus in quantum neural networks — PennyLane

Thanks Kamu-quant! I didn’t know about that experiment. It was great to learn about it and see what Google did experimentally. Thanks again!

Hi Damian_Pope,

Thank you for your interest in Pennylane!

I’ll answer the first question as Kuma-quant already gave a thorough answer to the second.

You are absolutely correct that the two Hadamard gates can be simplified out. We plan to offer a variety of available circuit simplifications in future releases of Pennylane. For now you would have to manually make the simplifications.

However, for a circuit of this size the speedup from this simplification would likely be negligible, so the two Hadamard gates remain in the tutorial for pedagogical reasons.

Best,
Trevor

Thanks Trevor! Very helpful. Good to know that circuit simplifications are planned.