An issue in the FALQON demo

Hi all,

I am a new user of Pennylane and the awesome set of demos have been really helpful to get me started.

This post is about the demo on feedback-assisted quantum optimization (FALQON). There seem to be a couple of issues with the provided example code that I am unable to figure out.

1 - The displayed cost_h of the example contains a hidden factor of 1/4 coming from the first summation term of the cost Hamiltonian H_c written in the general description. I don’t see why this is.

2 - The build_hamiltonian(graph) function however doesn’t appear to account for this 1/4 factor, and works with the general form of the H_c. As a result, if one instead directly uses qml.commutator(driver_h, cost_h) (leaving aside the factor of i for the moment in the required quantity i[driver_h, cost_h]) to compute the required commutator, the answers do not match. For bigger graphs and more general problems, an explicit computation of the commutator as encoded in the build_hamiltonian(graph) would be tedious.

It’s possible that my queries turn out to be silly because I am missing something very simple. In any case, I’d appreciate any resolution and help.

Hi @adityab,

Welcome to the Forum!

Your questions don’t seem silly at all. In fact it helps a lot when you ask questions here!
I’ll check the details and get back to you on your questions over the next couple of days.

Thanks again for asking here!

Hi @adityab,

You uncovered some really interesting things!

  1. The hidden factor of 1/4 seems to be coming from a normalization in the edge_driver function (used internally by qaoa.max_clique). The demo’s cost Hamiltonian formula is missing this 1/4 factor on the edge penalty terms. Both Hamiltonians share the same ground state, so the optimization result is unaffected, but the formula and the code output don’t match. Great catch here!
  2. This is related to the missing factor of 1/4 too (plus another error).
    • Since the factor of 1/4 was missing in the formula for Hc, it’s also missing in the commutator and it’s also missing in the build_hamiltonian formula. The factor there should be 6/4 instead of 6.
    • In addition to this, the second term in Hc has factor 1 so the second term in the commutator should have factor 1, so the terms in the second sum in build_hamiltonian should have factor 2.

Despite these mismatches, the FALQON algorithm converges because:

  • The sign of β_k = −⟨i[H_d, H_c]⟩ is preserved (the operator structure is correct, only the magnitudes differ)
  • The magnitude difference is effectively absorbed into the hyperparameter Δt
  • The guarantee d/dt ⟨H_c⟩ ≤ 0 holds as long as β(t) has the correct sign

For larger/general problems, you can bypass build_hamiltonian entirely and just use qml.commutator. I’m not completely sure that the code below would work but you could give it a try.

cost_h, driver_h = qaoa.max_clique(graph, constrained=False)
comm_h = qml.simplify(1j * qml.commutator(driver_h, cost_h))

This would give the mathematically exact i[H_d, H_c] for the actual cost_h returned by PennyLane, and it should work for any graph.

Let me know if this helps!

1 Like

I opened this GitHub issue so that we have traceability for this issue.

Thanks for making us aware of this!

Hi @CatalinaAlbornoz ,

Thanks a lot for your clarifying replies. Definitely helps !

And no worries, I am glad I could catch this issue and accidentally help make the demo clearer.

1 Like