Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Depolarizing SPAM in H-Only Models Silently Fails (and Discussion of How to Properly Regularize Reduced Models) #476

Open
coreyostrove opened this issue Aug 12, 2024 · 0 comments
Assignees
Labels
bug A bug or regression
Milestone

Comments

@coreyostrove
Copy link
Contributor

When using the depolarize model method with an H-only error model and specifying only the value of the spam_noise kwarg the method quietly fails. The H-only part is almost certainly a red herring, as in general the expectation would be that this should loudly fail for any error generator parameterized SPAM operation, as is the case for operations. We should either a) finally go ahead and implement the depolarize method for SPAM (at which point we can add checks for whether it possible to depolarize the model given the available error generator parameters) or b) add some checks to ComposedState (and probably ComposedEffect) like what are present for ComposedOp. Bookmarking this issue for a future fix.

To Reproduce
The code below will reproduce this behavior. The H-only part shouldn't be necessary to reproduce this (but that is the context in which I stumbled into this, so it is reflected in the copypasta below).

from pygsti.modelpacks import smq1Q_XY
target_model = smq1Q_XY.target_model('H')
depolarized_model = target_model.depolarize(spam_noise=1e-3)

Since this is an H-only model we can't depolarize it, but it does nothing silently. If we instead had set the op_noise kwarg in the depolarize call above it would have raised the following exception:

ValueError: Cannot set the value of a ComposedOp directly!

Environment (please complete the following information):

  • pyGSTi version 0.9.12
  • python version 3.9

Additional context
Some context for how I ran into this. There are a few places in the code where we need to regularize an input model for some particular calculation, and one of those is in computing the fisher information (which divides by probabilities at one point). So, by default the first thing the fisher information code does is add a small amount of depolarization to the SPAM. I had forgotten about this when doing some fisher information calculations on an H-only error model and ran into some divide-by-zero errors. After being first confused about why I was getting these when the regularization was turned on, and then face-palming when I realized that this of course does nothing on an H-only error model, I then found myself confused at the fact that an exception wasn't raised.

Computing Fisher information for various reduced models is something we want to do fairly regularly, so we should look into the proper way to manage regularization for reduced models. For this particular case I am going to manually regularize this by adding in a small unitary perturbation (if anyone thinks that is a bad idea in the context of Fisher info let me know), but it would be good to figure out a general scheme.

@coreyostrove coreyostrove added the bug A bug or regression label Aug 12, 2024
@coreyostrove coreyostrove added this to the 0.9.14 milestone Aug 12, 2024
@coreyostrove coreyostrove self-assigned this Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug or regression
Projects
None yet
Development

No branches or pull requests

1 participant