How to encode a superposition qubit state as state preparation in QONN?

I am following the tutorial on QONN by @theodor where I am stuck on a problem of encoding a qubit state. This is occurring because of my uneasiness with Dual Rail Encoding.
All the examples we have in the demo are basis state. But I want to know/understand how a general state can be encoded as qml.Fockstate can only take integer values.
For a clear answer, I can give you an example problem. Say, I want to use QONN to take me from GHZ states back to 0 state. Now, to do this I have to encode GHZ state in x. How can I do it? In the demo, it is given the other way round. Could you demonstrate me this type of encoding?

Thank you for your time

Hi @Prabhat_Prabhat,

In this Strawberry Fields demo on CV QNNs, the encoding is made using several gates depending on the number of modes. In this demo the training is done to learn a specific target state. I know it’s not exactly encoding a GHZ state but maybe it can give you ideas for how this works.

Let me know if this helps, or if this doesn’t answer your question please let me know and I’ll try to explain it in a different way.

Hi @CatalinaAlbornoz,
The inherent difference in the CVQNN from QONN is the encoding scheme. In QONN, they use “dual rail” encoding in which encoding of only basis states are demonstrated. I am not getting an idea how to do it generally in this new scheme discussed in QONN.

Hi @Prabhat_Prabhat, thank you for the clarification. In the demo they seem to be using Fock state encoding. I don’t know the paper in the demo though. Let me give it another look in the next couple of days.

1 Like

Thank you @CatalinaAlbornoz. That’s exactly my problem!! One can use Dual rail encoding in CVQNN structure with Fock state encoding (exploitation). But that is not general, and nobody in the literature (as far as I can search) talk about it and hence the confusion. I’ll be waiting for your reply :slight_smile:

Hey @Prabhat_Prabhat! Apologies for the delayed response. We haven’t forgotten about your question and will get back to you this week :slightly_smiling_face:

1 Like

Hi @Prabhat_Prabhat,

Thanks for your question. If I understand correctly, you’re asking how one might use more complex states as inputs to the QONN (or the CVQNN, which is in some ways similar)?

One can definitely use any input state to either of these networks. I’d expect the performance would be heavily dependent on which state one puts in and which network, but generally I’d say the fundamental ideas behind both do not specifically require fixed Fock-number basis states (of which dual-rail encoded states are a special case) as input.

However, the heart of your question, I believe, is how to create other types of states than Fock-number basis states and use these as input? Well, actually it’s not very easy :sweat_smile:.

It can be the subject of an entire research paper to propose clever methods to make some of these more advanced states (e.g., GKP states, cat states, etc). Many states have only been proposed theoretically, without practical protocols for creating them in practice being yet demonstrated. If you didn’t find any papers to your satisfaction, this might be why :smile:

We do support a limited number of such states directly in Strawberry Fields (I’m not sure if these are available in the PL-SF plugin). Specifically, Catstate and GKP states. If you have a specific state and you know how to write it in the Fock basis, you could also use Ket. You could code up the QNNs as in the papers, but replace the state prep steps with one of these states.

As a final technical aside:
The procedures to create these more complex states usually all share some common elements: start with a more conceptually simple state (any Gaussian state, single-photon states, basically states that are easy to make in the lab), then apply some optical nonlinearity (these can be a gate/interaction, but often measurements are more within reach). In the lab, they are quite challenging to do!


Thank you @nathan, yes I was expecting (at least theoretically) that I could prepare any state just by giving a vector into the circuit. Let’s say, I am using 4 qumodes with a cutoff of, let’s say, 5. Now, a general pure vector would be one with 625 dimensions. This contains all entangled states too. But I believe that Strawberryfields doesn’t support this type of state preparation yet (I won’t be using the PL-sf plugin). Now, as you mentioned, this is because of the inherent difficulty in preparing these states on real hardware, that is, Borealis or X8. But can’t we build these operations for simulator purposes only? Because, anyway we can’t access the photonic hardware without privileges and hence, I am exploring these things on simulators only. Let me know if I can contribute to this also!!

Hi @Prabhat_Prabhat ,

I don’t have a full answer to your question but I can talk about the contribution part. At the moment our hardware team is fully focused on making our next-generation quantum computers. This means that at the moment we’re not adding new features to Strawberry Fields. You are totally free to create a fork of the GitHub repository and make your own augmented version of Strawberry Fields!
Please let me know if you have any questions on how to do this.

1 Like