Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Modularize error mitigation techniques #2253

Closed
natestemen opened this issue Mar 29, 2024 · 5 comments
Closed

Modularize error mitigation techniques #2253

natestemen opened this issue Mar 29, 2024 · 5 comments
Assignees
Labels
needs/agreed-design Needs a plan of action that is agreed upon to complete.
Milestone

Comments

@natestemen
Copy link
Member

Idea

Many quantum error mitigation (QEM) techniques take place in two general phases.

  1. Create circuits based on some protocol/algorithm (ZNE: noise scaled circuits, PEC: probabilistically sampled circuits, DDD: circuits with idle windows filled in, etc)
  2. Take results from the execution of circuits in step 1 and combine them in special ways to obtain the QEM estimator.

Ideally, each technique in Mitiq should have a function available for each of these steps that authors can then use to both better understand what's happening, and hack on these techniques.

Example

Here's what this could look like. Ideally all techniques will have the same interface so it's easy to hot swap techniques. function names subject to change, just brainstorming.

circuits = mitiq.zne.intermediary_circuits(
    circuit_of_interest,
    scale_factors=...,
    scale_method=...,
)

# user can now inspect circuits and understand what they look like, and how many there are.
# run circuits and save them into results
results = ...

mitiq.zne.combine_results(
    results,
    circuits,
) # ordering needs to remain the same results/circuits in order for QEM techniques to work correctly.
@natestemen natestemen added the needs/agreed-design Needs a plan of action that is agreed upon to complete. label Mar 29, 2024
@natestemen natestemen added this to the v0.36.0 milestone Mar 29, 2024
@FarLab FarLab assigned FarLab and jordandsullivan and unassigned FarLab Apr 12, 2024
@jordandsullivan
Copy link
Contributor

Sharing a few ideas here which I have come across in working on other issues:

  • CDR calls a method within zne.scaling called fold_gates_at_random. We could take out zne.scaling and zne.inference as common methods
  • There is a class already within Calibration called MitigationTechnique. We could pull this out as a class and put it in mitiq.qem and make it the class which all the other methods instantiate from
  • Potentially pulling out non-public helper functions and utils from zne.folding
  • Maybe change data structure for e.g. zne.folding._valid_gate_names to an enhanced enum

@nathanshammah
Copy link
Member

Thanks for the very nice comments @natestemen @jordandsullivan. We should gauge how to fold this approach in a way that doesn't make categorization in the way of usability. If there was a way to implement this more as "tagging" rather than re-classifying functions, maybe I would like it more. That said, really happy to see this move forward as it's important also for composing techniques, #2288.

@jordandsullivan
Copy link
Contributor

Another example that I think wouldn't risk breaking compatibility would be these serial_executor and batched_executor which live in test_pec, but are used in many tests elsewhere and appear to be useful in calling using PEC and DDD more generally.

These functions could be taken out of tests and put in a utilities module, or added as perhaps even added as class methods onto Executor.

@jordandsullivan
Copy link
Contributor

Possibility of taking extrapolate functions out into their own module.

@cosenal cosenal modified the milestones: v0.36.0, v0.37.0 May 3, 2024
@cosenal
Copy link
Contributor

cosenal commented May 31, 2024

Converting this to a discussion. We will create a new issue for a proof of concept of this modularization on one of the techniques (e.g. ZNE) with specific use cases in mind.

@unitaryfund unitaryfund locked and limited conversation to collaborators May 31, 2024
@cosenal cosenal converted this issue into discussion #2394 May 31, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
needs/agreed-design Needs a plan of action that is agreed upon to complete.
Projects
None yet
Development

No branches or pull requests

5 participants