Friday, November 29, 2024

ZNE_Moment

 Went back to Qiskit this morning. The most recent version of things does not allow one

to simulate resilience directly. I ended up importing mitiq, which is a python module for

error mitigation. It has a ZNE function, so I used that with StatevectorEstimator. Code from

perplexity ai:






The circuit was deemed too short, so I did a second run:

                                                                                       







                                                                                

https://www.perplexity.ai/search/qiskit-i-would-like-to-use-sta-xcWo0YzdS36iWrEMyFXByg#14

                                                                  *     *     *

In effet, using mitiq in a simulation is something of an oddity. It follows a

procedure working from discrete noise readings to estimate zero-noise. In a simulation,

departues from strict parity are worked in at each run. 

Below, Copilot's description of how mitiq 'gets the job done':

Zero-Noise Extrapolation (ZNE) in Mitiq is an error mitigation technique that estimates the noiseless expectation value of an observable by extrapolating from measurements taken at different noise levels. Here's a simplified explanation of how it works:
Noise Scaling: The first step involves intentionally increasing the noise level in the quantum circuit. This can be done using various methods such as:
Unitary Folding: This method involves repeating certain gates in the circuit to increase the noise. For example, a gate 
G can be replaced with GG†G, effectively increasing the noise without changing the ideal outcome.
Identity Insertion: This method adds identity operations to the circuit, increasing the circuit's depth and thus the noise.
Pulse Stretching: For devices with pulse-level access, the duration of the pulses can be increased to scale the noise.
Extrapolation: After running the circuit at different noise levels, the next step is to fit a curve to these noisy results and extrapolate back to the zero-noise limit. This involves:
Collecting Data: Running the circuit multiple times at different noise levels and recording the expectation values.
Curve Fitting: Using mathematical models to fit a curve to the collected data points.
Extrapolation: Estimating the expectation value at zero noise by extrapolating the fitted curve.

Below, Copilot code to showcase ZNE with mitiq:

                                                                             


                                                                             
My input values for '00000' are  either all zeros or all 1s, not a realistic case at all.

And noise values are not linear. Still, the math pulls through...

I am looking forward to testing this on an actual Estimator run with a quantum 

computer😺





                                                                       










     

                                                                                                                   
       
  

    
                                                                                      
                                                                                                       











No comments: