-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
New Technique: Equivalent Circuit Averaging #2265
Comments
Sure. I think starting with a simple resynthesis workflow with different seeds is a good place to start. from bqskit.compiler import Compiler
from bqskit.passes import SetRandomSeedPass
from bqskit.passes import QuickPartitioner
from bqskit.passes import ForEachBlockPass
from bqskit.passes import QSearchSynthesisPass
from bqskit.passes import UnfoldPass
num_eca_circuits = ...
bqskit_circuit = ...
workflow = [
QuickPartitioner(3),
ForEachBlockPass(
QSearchSynthesisPass(),
replace_filter = "less-than-multi",
),
UnfoldPass()
]
eca_circuits = []
with Compiler() as compiler:
for i in range(num_eca_circuits): # maybe randomize i?
seeded_workflow = [SetRandomSeedPass(i)] + workflow
eca_circuit = compiler.compile(bqskit_circuit, seeded_workflow)
eca_circuits.append(eca_circuit) If needed, there are still ways to improve performance and quality, where structural differences in the ECA circuits measure quality. There will likely be some trade-offs to explore for this use case. Both options for an ECA workflow with BQSKit will work. I am not 100% sure, but I do think that operating after compilation will produce results faster, while operating before compilation will produce more variety. One important note about the previous code, is that the compilation will not respect circuit topology or gate set. So running it after compilation may make it unexecutable given a specific backend. If you would like to instruct it to maintain both topology and gateset of a given hardware, we can build a |
Background
Equivalent Circuit Averaging (ECA) is a quantum error mitigation technique introduced in Optimized SWAP networks with equivalent circuit averaging for QAOA as a technique which
Crucially, this technique relies on having a compiler that is able to take into account those degrees of freedom. Last year, @edyounis (lead developer of BQSKit) approached us with the idea of adding this as a technique in Mitiq, using the BQSKit compiler as the tool to do this. Ed helped us write some basic code to prototype what this could look like, and it's demonstrated in this notebook. When reviewing the code together this week and discussing the fact that it currently runs quite slowly, Ed noted that there are a myriad of ways to speed it up by not asking for a full compilation pass. @edyounis, can you provide some more details on how we might go about speeding this up?
Implementation
There's (at least) one big decision we have to make when thinking about the design and implementation of this technique and that's answering the question do we expect the user to have compiled the circuit for their desired backend before performing ECA?
Option 1: compilation in the executor
First, the way in which we normally ask users to engage with Mitiq by just handing us their circuit of interest and operating on that. Here, we are generally agnostic to whether the circuit has been pre-compiled for a specific backend or not, but there are times when we might potentially add in gates that could be outside the compiled gateset (e.g. dynamical decoupling inserting$XX$ or $XYXY$ gate sequences).
Option 2: compilation ahead of ECA
The second possible workflow requires that the user compile their circuit before passing it to Mitiq. Ed mentioned their might be benefits to this approach, as having a shorter, compiled circuit, would make the ECA process even quicker. Ed if there are more details here as to why this approach might be advantageous, please do add!
It is possible to imagine Mitiq subsumes the "Compile" step in the diagram below, but allowing the user to pass a device topology and gateset for "Mitiq" to compile with (using BQSKit) before starting the ECA process.
Existing implementations
Infleqtion has implemented ECA as part of superstaq's
aqt_compile
function.The text was updated successfully, but these errors were encountered: