3
$\begingroup$

I have been reading Farhi and Neven's paper on quantum neural networks on quantum circuits. I also found an example - albeit not ideal as pointed out by a couple of users - thank you - in here.

From these sources I used Cirq to build the following circuit: enter image description here

From this circuit, and from reading Farhi et al., I added the following:

enter image description here The modifications:

  1. A 5th qubit to be a readout bit (ancilla) to measure the predicted label of the readout bit.

  2. A Pauli-X gate to ensure the readout bit would be |1> following Farhi's paper prior to start measuring the predicted label.

  3. N-bit toffoli gate to indirectly measure the ansatz to measure the effects of the $(\beta, \gamma)$ in the circuit as these are changed.

  4. Hadamard layer before entering the operations shown in the picture above. I did this to be able to apply the optimization algorithm successfully; otherwise, without this first Hadamard layer, it will never converge.

Having a readout bit that can measure the ansatz, and following the QNN paper, one defines:

loss$(\theta,z) = 1 - l( 𝑧 )𝑃(\phi)$,

where $P(\phi)$ is the result of measuring the output of the readout bit as you change $\beta, \gamma$, and $l(z)$ is the label of quantum bit. It turns out that for the purposes of implementation this relation can be stated as:

loss$(\theta,z) \approx 1 - [𝑃(\phi)]^2$,

I have applied this technique to this circuit, and while for some cases the technique performs well, I see some instances this output:

enter image description here

Plot on the left shows the loss function as parameters in circuit are variated; Plot on the right shows the state of readout bit under optimization process. Presumably, since the readout bit after X-gate is converted to |1>, the minimization of the loss measured in this system will return the readout bit to this state. That said, if you find this assumption also questionable, please let me know.

And it can get much worse:

enter image description here

So, here are my questions:

  1. Clearly the loss function shows something is not right with this setup. Granted, the circuit itself can be flawed, I for one I am not sure if acting Pauli-X on the readout bit and then n-toffoli gate was the right thing to do. That said, I am not sure about that after this results. How do you "debug" a circuit with this in mind?

  2. As a general question, given that from this toy-model it is clear that one cannot willy-nilly apply QNN to any random circuit, what is the criteria, if any, Hamiltonian / random quantum circuit, must have to be worth applying this technique.

  3. Are there any better ways to extract information of the circuit for an optimization method than the n-toffoli approached I took? For example, I know it is a silly question, but can you illustrate how useful it can be to apply measurement gates to all the qubits?

  4. Suppose you are shown this picture of the circuit, how can one take the circuit layout and go back to the Hamiltonian for the circuit? I ask because I am both fascinated and a bit confused about how can the Ising, Hubbard-fermi, among many others, are represented by a hamiltonian that can also be expressed as a quantum circuit through an ansatz.

Just for reference, optimization algorithm I implemented is the one discussed on Farhi et al but with the modification of Adam to SGD. On a paper out of Google X last two weeks ago they shown it could successfully be applied for machine learning applications on both quantum circuits but also Tensor Networks.

Sorry for the long post. Thank you for reading, and thanks in advance for your feedback.

$\endgroup$
  • 1
    $\begingroup$ The text diagram you showed is not the same as the image. The Z gates are on the wrong lines. $\endgroup$ – Craig Gidney Jun 27 at 17:35
  • $\begingroup$ @CraigGidney: I just made the modification thank you! That said, it does show, while not quite as strong a gain in the loss, nonetheless a gain for a period of iterations. My understanding is that such a situation is a non-starter. $\endgroup$ – Enrique Segura Jun 27 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.