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

precision argument of BackendEstimatorV2.run should account for observable norm #12414

Open
kevinsung opened this issue May 15, 2024 · 5 comments
Assignees
Labels
mod: primitives Related to the Primitives module type: feature request New feature or request

Comments

@kevinsung
Copy link
Contributor

kevinsung commented May 15, 2024

What should we add?

The current implementation sets shots = 1 / precision**2. This is sufficient for a single Pauli operator with norm 1, but it is insufficient for a Hamiltonian with more terms and greater norm. I think it should be A / precision**2 where A is the sum of the absolute value squared of the coefficients of the Hamiltonian, sum(np.abs(sparse_pauli_op.coeffs)**2).

@kevinsung kevinsung added the type: feature request New feature or request label May 15, 2024
@ihincks
Copy link
Contributor

ihincks commented May 15, 2024

I think that this issue should be filed against particular EstimatorV2 implementations, rather than the base class. This is because the base class can't really enforce how any child chooses to deal with precision. Note that "precision" should always be interpreted as "give me your best guess attempt to satisfy this precision".

For example, the StatevectorSimulator has no notion of shots whatsoever, because it just grabs observable estimates straight from the state vector, and sets the stds to 0 because they're perfect estimates.

The other thing to point out is that shots = A / precision**2 is not always the right thing to do even if the simulation is shot based, because effects like drift might make it so that shot noise is not the only source of noise affecting precision.

@kevinsung
Copy link
Contributor Author

I agree that shots = A / precision**2 where A scales with the Hamiltonian norm is not perfect, but I think it's a better representation of a "best guess attempt" than setting A = 1, so I think it makes sense to update the default implementation to use it.

@ihincks
Copy link
Contributor

ihincks commented May 15, 2024

But what's the default implementation? If qiskit_ibm_runtime.EstimatorV2, then we can move this issue over there, or to a server-side implementation. If BackendEstimatorV2 or something in Aer, we can also move or specify.

@kevinsung kevinsung changed the title precision argument of EstimatorV2.run should account for observable norm precision argument of BackendEstimatorV2.run should account for observable norm May 15, 2024
@kevinsung
Copy link
Contributor Author

Oh I see what you mean. I've changed the title of this issue because it actually refers to BackendEstimatorV2 specifically.

@kevinsung
Copy link
Contributor Author

I opened Qiskit/qiskit-ibm-runtime#1684 for the implementation in Runtime. It appears that Runtime uses their own implementation of BackendEstimatorV2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mod: primitives Related to the Primitives module type: feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants