Has anyone used PyMC (or other PPLs) to optimize quantum circuits?

Hi everyone,

I’m working on a hybrid quantum–classical model for deepfake detection, where a quantum circuit forms part of a variational model. I’m currently using classical optimizers (Adam, SPSA, etc.), but I’m curious whether probabilistic programming could offer a more principled or more stable way to optimize the quantum circuit parameters.

More specifically:

  • Has anyone tried using PyMC to place priors over quantum circuit parameters and perform Bayesian optimization or posterior inference?

  • Are there examples of using PyMC to tune parameters of variational quantum circuits (VQCs) similar to how we tune weights in a neural network?

  • Is this something that could work well with hybrid setups (classical PyMC + quantum circuit simulator/real QPU in the loop)?

  • If you’ve done something similar with NumPyro, Pyro, or TensorFlow Probability, I’d also really appreciate hearing about your experience.

My goal is to adapt quantum circuit parameters in a way that incorporates uncertainty and avoids some of the instability I’ve seen with gradient-based optimizers. Any pointers, examples, or references would be extremely helpful!

Thanks in advance!

What does the target log density look like? If it’s highly multimodal, sampling isn’t going to work in the sense of being able to give you proper Bayesian posterior uncertainty (i.e., you can’t solve the posterior predictive inference integrals even to a few decimal places as you can with MCMC).

As a side note, if you take the usual Bayesian estimator, the posterior mean, it’s different than the mode. The posterior mean is an unbiased estimate that minimizes variance, assuming the model is correct. In the limit of growing data, the posterior mean and maximum likelihood estimator converge to the same result (modulo some assumptions such as the parameters not growing with the data).

Usually something like L-BFGS and sampling are unstable in the same places, with L-BFGS having a slight advantage being able to do a low-rank adaptation to the local curvature. I don’t have experience with Bayesian optimization, but if the dimensionality isn’t too high and the function isn’t too high frequency, then it should be able to regularize.