LWKJJONAK / Quantum_Neural_Network_Classifiers

Codes for efficiently implementing quantum neural network classifiers
MIT License
78 stars 13 forks source link

Amplitude -encoding #5

Closed erlebach closed 1 year ago

erlebach commented 1 year ago

I have a question on the Amplitude-encoding demo. On a real Quantum Device, what parts of the simulation are done on the quantum computer and what part is done on a classification machine? For example, where is the training loop executed? Thanks.

LWKJJONAK commented 1 year ago

Actually, the classification machine is deployed on the quantum computer. The quantum device can be utilized to deploy the QNN model and calculate the gradients, then the model parameters can be optimized with these gradients (optimizers such as Adam can be utilized as well). Let me use a more concrete example:

In our recent work Experimental Quantum Adversarial Learning with Programmable Superconducting Qubits (accepted by Nature Computational Science), we implemented such a QNN classifier on a 36-qubit superconducting quantum processor. In this work, we deployed both the block-encode QNN (for classical medical images) and amplitude-encode QNN (for quantum many-body state data) on quantum devices. With the parameter shift rule, we can calculate the gradient of the loss function w.r.t the model parameters, and further update these parameters. The training loop is executed on this quantum processor (i.e. these are not numerical simulations on our PC but are real quantum experiments) (of course, control software is utilized to monitor the process and collect data).

erlebach commented 1 year ago

Thanks. So here are a few things I do not understand. We could have a zoom conversation if you are willing. I am not sure this is the proper forum. But here are some questions, which are hard to find answers for: 1) how many measurements are typically needed on the quantum machine to get reliable results? 2) If one needs N measurement repetitions, is it also necessary to prepare the input data N times? 3) What is the cost of each repetition, including data preparation and running the quantum circuit? 4) How does one run iteration loops on the quantum machine? 5) Where can I read more about these kinds of details? Most papers do not mention them.

Thanks!

LWKJJONAK commented 1 year ago

Hi, we already added some of the details you mentioned in the revised paper (maybe appear in NCS in a month). I live in the GMT+8 (Beijing) time zone and maybe we can arrange a Zoom meeting at a suitable time for both sides. Maybe we can communicate about this through emails (lwk20@mails.tsinghua.edu.cn).

erlebach commented 1 year ago

Hi, did you receive my email?

LWKJJONAK commented 1 year ago

Yeah I received your email (for my edu mailbox, there are large delays in message delivery to receive emails from America) You sent it at 2:00 am but I didn't see it at 2:40 am and then I went to sleep lol