QNN on real IBM device

Hello,

I am trying to run somewhat same code as in this tutorial (only for global cost function case) with quantum circuit depth of 2 on a real IBM quantum device. it took roughly around 15 hours to print the cost value after first 5 steps, (Note that the total steps will be 20), which I believe will be 15*20 hours in total.
Is it normal that it took this long? If so why is it taking so long, isn’t the actual hardware supposed to be faster or atleast equivalent in speed to that of a simulator (default.qubit)?

Any leads on that would be appreciated.

thanks

Hi @Muhammad_Kashif,

If you run on IBM devices you will have to wait in the queue in order to use the device. Depending on how you write your program you will create several jobs, and this means waiting in the queue every time. In fact for algorithm design we often use simulators. Our fastest simulator is lightning.qubit so I encourage you to use that one.

Additionally to the wait time of being in the queue (which is probably the main cause of your wait times), there are some delays when running on an IBM simulator compared to running on a PennyLane simulator because PennyLane needs to make the connection to IBM and this can take a couple of seconds.

If you really want to run on IBM hardware something you could try using Qiskit runtime with PennyLane. Here you can find the documentation for this.

So as a summary:
1 - Use PennyLane simulators such as ‘lightning.qubit’ if you need speed and don’t necessarily need the actual quantum hardware
2 - Use Qiskit Runtime for some speedups if you need to run on actual quantum hardware

Please let me know if you have any further questions!