Closed kevincsmith closed 2 years ago
I am guessing this is because your scheduling has added delay
operations at the end and the routine thinks those measurements are no longer terminal operations.
Thanks, @nonhermitian. I can confirm that delay
operations appear after the first two measurements. Is the measurement error mitigation not intended to work with mid-circuit measurements? If so, is there a suggested workaround?
It can. The tools were developed really before mid circuit measurement was a thing. There is also the issue of how to tell a mid circuit measurement that is not being used to condition a later gate. But that can probably be done as well.
@nonhermitian when there is a new release of mthree, this should be fixed
This is now fixed in M3 v1.1.0 that has just been released
Describe the bug Qiskit Runtime’s built-in measurement error mitigation returns erroneous results if measurements are asynchronously scheduled. In particular, it seems some bits are "dropped" relative to the unmitigated Counts.
Steps to reproduce Here is a minimal example that will reproduce the error. Below the same circuit is transpiled in two different ways -- once using ALAP and once using ASAP scheduling method. Both circuits are then run using the circuit-runner program on ibm_lagos.
Expected behavior After execution, I extract both raw and error mitigated counts:
As expected,
counts_raw[0]
,counts_raw[1]
andcounts_mit[0]
all contain keys with four bits each.counts_mit[1]
(corresponding to the ASAP scheduling), however, entirely contains keys with two bits each (see attached screenshots).I believe the error has to do with the asynchronous measurements when I use the ASAP scheduling -- see attached screenshots for timelines of each scheduled circuit. As a simple test, I repeated the above experiment but used a barrier before the measurement stage for both scheduling methods in order to force all measurements to take place simultaneously. In this case, the error mitigated quasiprobabilities returned the expected results.
One final note which may or may not help -- I have separately observed this same bug when measuring the same qubit multiple times in a single circuit. In this case, the error mitigated quasiprobabilties somehow reduce to just the final measurement.
Any advice on a workaround is much appreciated.
Suggested solutions
Additional Information
Circuit 1 timeline:
Circuit 2 timeline: