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

Align definition of scale factor with Zero-Noise Extrapolation literature #983

Open
cosenal opened this issue Aug 1, 2024 · 5 comments
Open

Comments

@cosenal
Copy link
Contributor

cosenal commented Aug 1, 2024

The mitigate_with_zne API in Catalyst accepts a scale_factors argument, which represents a range of scalar factors by which the circuit is scaled.

In the literature of Zero-Noise Extrapolation 12, a scale factor value $\lambda$ is the ratio between the number of gates of the scaled circuit and the number of gates of the original circuit. However, in the Catalyst implementation, the term scale factor is used to denote the number $n$ of foldings of the circuit.

The relation between the two definitions is $\lambda = 1 + 2n$.

For example, scale_factor = 1 (i.e., $\lambda=1$, $n=0$) means that the circuit is not folded.
For scale_factor = 3 ($\lambda=3$, $n=1$), we have that the circuit is folded once

$$C \rightarrow C(C^{\dagger}C)$$

and the number of gates in the scaled circuit is three times the number of gates in the original circuit.
(See 2 for a discussion on odd/even/non-integer scale factors.)


This issue is about aligning the definition of scale factor in Catalyst with the literature as above, by either renaming the scale_factors argument in the API, or assigning a new meaning to it.

Footnotes

  1. https://arxiv.org/abs/2005.10921

  2. https://mitiq.readthedocs.io/en/v0.38.0/guide/zne-3-options.html#what-additional-options-are-available-when-using-zne 2

@cosenal
Copy link
Contributor Author

cosenal commented Sep 9, 2024

@rmoyard
Copy link
Contributor

rmoyard commented Sep 10, 2024

I will tackle that in the upcoming days 👍

@cosenal
Copy link
Contributor Author

cosenal commented Sep 10, 2024

Nice, thanks @rmoyard. Please keep me in the review loop of the design and PRs.
Is the plan to do the same as Pennylane, that is, convert the scale factor in a folding factor and keeping the folding as is? Is it going to be in the frontend or in the dialect?

@rmoyard
Copy link
Contributor

rmoyard commented Sep 10, 2024

Yes I think that is the best, I will either add some restrictions because we don't support the fraction scale or just just ignore the fraction scale.

num_global_folds, _ = _divmod(scale_factor - 1, 2)

@cosenal
Copy link
Contributor Author

cosenal commented Sep 10, 2024

num_global_foldsnum_folds, since this will have to be the same way for both global and local folding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants