Relationship of the number of qubits and the execution

Hi!
Why is it that when I increase the number of qubits, the execution time of my program is longer? The highest number of qubits that I can use in my hybrid neural network is 16. Thank you

Hi @aouie, I’m guessing that you’re using a simulator. Simulators use classical computers to model what a quantum computer would do. However, in general it’s inefficient for a classical computer to simulate a quantum one. This is part of the interest in using actual quantum hardware! As you increase the number of qubits you’re trying to simulate the classical computer takes more and more time. At some point your computer runs out of memory and you find the limit of what you can simulate in your current computer.

Something you can try is using circuit cutting to break your computation into parts. It will increase the classical processing time, but it may allow you to simulate larger circuits because it might help with some memory issues.

You can learn more about circuit cutting from our documentation and from this demo.

Please let me know if you have more questions!

1 Like

Yes, I’m only using a simulator now. I know this is a funny question but for a classical computer, as the number of bits increases, the performance also better, like 32-bit computer and 64-bit. But when I increase the number of qubits but using a simulator it takes a long time. I’m sorry this is really a funny question. Thank you!

Hi @aouie!

There’s an important thing to note here: a quantum computer with more qubits and lower errors is generally more powerful. This is similar as with classical computing. So, in very simple terms, if you had a Fault-Tolerant (no errors) quantum computer with 64 qubits, it would be considered more powerful than a quantum computer with 32 qubits. This is a simplified answer because there are other important aspects to consider, but it gives you the main idea.

Simulating a quantum computer can allow you to explore the results that a quantum computer would give you, but note that there’s a classical computer running this simulator. To simulate a quantum computer PennyLane uses a lot of equations to model what the actual quantum hardware would do. Each time you add a qubit PennyLane needs to add an exponential number of equations so as you try to simulate larger computers it requires more and more effort from the classical computer. At some point your classical computer reaches its limit and the computation fails.

If you want to keep learning about quantum computing I encourage you to go through the Xanadu Quantum Codebook. It will help you learn both the theory and the practical use.

1 Like