2
$\begingroup$

Being Quantum Computers with more than 5-7 qubits quite expensive (especially IBM's) I was wondering if it makes sense to pre-train a quantum machine learning model on a noisy simulator, store the weights and eventually load the model from a checkpoint to make inference on unseen data but, this time, on a real quantum device. The purpose would be assessing the performances of the simulated version vs the real device one. Ideally I wanted to both train and test on the real device, but that's too expensive for my institution.

What about repeating the same procedure but with a noiseless simulator ? I believe it's not going to be a good idea, but I can't find a clear way to explain it.

$\endgroup$
3
  • $\begingroup$ why do you need a quantum machine learning model for this? $\endgroup$
    – MonteNero
    Sep 11, 2022 at 18:44
  • $\begingroup$ I'm studying a quantum machine learning model and I'm trying to deploy it to real quantum hardware to assess his real performances (for research purposes, clearly). $\endgroup$
    – mpro
    Sep 11, 2022 at 20:33
  • $\begingroup$ Sorry, I completely misunderstood your question. Now after your clarification, I understand what you meant. $\endgroup$
    – MonteNero
    Sep 11, 2022 at 23:15

4 Answers 4

1
$\begingroup$

It seems to me that you're implicitly asking a few different questions so I will try to address these with some general comments.

Pre-training quantum models

If your goal is to improve performance then it makes perfect sense to pre-train a model on a (noisy) simulator and then load those parameters as initial parameters for further training on the noisy device. This is (loosely) a very specialized form of transfer learning, and may be especially useful considering that device noise can result in untrainability of variational quantum circuits (Wang, 2021). It seems reasonable that this would improve your training convergence time (on hardware) compared to random parameter initialization unless the noise is very strong. If you have an effective training technique for the simulated model then this will (presumably) result in a better optimized model as well.

Of course, this is not a practical/realistic strategy for finding useful QML algorithms: If you can pre-train your QML model on a simulator then by definition it cannot demonstrate any kind of advantage over classical algorithms.

Inference directly from transfer learning

On the other hand, it does not make much sense to directly perform inference with a model on noisy hardware using weights optimized in classical simulation. Suppose you have input data $x \in \mathcal{X}$ and your QML model first encodes the data with some data encoding unitary $U(x)$ and then attempts classify the data with some parameterized unitary $V(\theta)$. As a toy example, suppose the hardware implements $V(\theta)$ perfectly but implements some channel $\mathcal{E}_U$ where $U$ should have been. Define

\begin{align} \psi(x) &= U|0\rangle \langle 0 | U^\dagger \\ \rho(x) &= \mathcal{E}_U(|0\rangle \langle 0|) \end{align}

Given some distribution of input data in $\mathcal{X}$, in the feature space we now have two different distributions of quantum states to classify. We will call "model 1" the simulated classifier ($V(\theta)$ trained on $\psi(x)$) and "model 2" the noisy-input classifier ($V(\theta)$ trained on $\rho(x)$), and both models receive input with respect to the same distribution $p$ over the classical feature $\mathcal{X}$. If $\theta_1^*$ is the set of optimal parameters for model 1 and $\theta_2^*$ is the optimal parameters for model 2, then in general we do not expect $\theta_1^* = \theta_2^*$. It perhaps more likely that $\theta_1^*$ is closer to $\theta_2^*$ than a random choice of $\theta$ (see previous section).

Because of this, it also doesn't make sense to use $\theta_1^*$ for inference with model 2. If model 2 performs well, you cannot guarantee that it actually would have reached that good of a performance by training on its proper inputs $\rho(x)$, whereas if model 2 performs poorly you cannot guarantee that this is due to noise/device faults or incomplete training (being far from $\theta_2^*$). You learn very little concrete information from doing inference with model 2 using $\theta_1^*$.

$\endgroup$
1
  • $\begingroup$ The second part of your comment is very illuminating, thanks a lot! $\endgroup$
    – mpro
    Sep 12, 2022 at 23:28
1
$\begingroup$

The main issue that I see here is the accuracy of the noise model. It can be extremely difficult (and a very interesting problem!) to produce an accurate noise model for the target quantum device to use with the noisy simulator, and you'll almost definitely find that even after training on the noisy simulator, the actual device will give you completely unexpected results. By the same token, a noiseless simulator is guaranteed not to train an accurate model for use on the device.

$\endgroup$
1
$\begingroup$

It is common to stay within the realm of simulators (with noise or noiseless). Showing that an arbitrary quantum model can or can't run on a very specific quantum device by a vendor X has little scientific value for anyone but the vendor X.

It is best to work with some generalized or theoretically tractable simulated noise scenarios. This way, your findings are independent of current hardware architectures. For all we know, the specific hardware you want to use can be obsolete tomorrow and be replaced by a newer device with different noise profile. Then whatever you tried is instantly irrelevant.

$\endgroup$
1
$\begingroup$

You can use fake providers in Qiskit to work with models of real QPUs. The fake providers behaves like their real counterpart. This means the noise model is the same and the connectivity among qubits is also the same. This should allow you to test your machine learning circuits on QPUs with more than 7 qubits. Here is a link to documentation of the fake providers class in Qiskit.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.