Skip to main content

How to execute your circuits with error mitigation

In Haiqu SDK, applying error mitigation to your workloads is extremely easy: you just have to toggle the correspoding flag use_mitigation=True in the haiqu.run function. Here is how it works for different settings:
1

Initialize your workloads

First, you need to specify one or multiple circuits to run and, if needed, the corresponding parameters and/or observables. For a reference on how to submit complex workloads, see API reference for haiqu.run.
circuit = QuantumCircuit(2)
circuit.h(0)
circuit.cx(0,1)

# in this case we measure the qubits to sample shots
circuit.measure_all()
You may use haiqu.log to log your circuit in the experiment to check some circuit analytics. No worries if you don’t, the circuit will be saved by Haiqu automatically when executed.
2

Specify the execution details

Before executing the circuits, you have to specify various execution details, such as device, optionsand the number of shotsto be used.
device = haiqu.get_device("ibm_torino")
options = {
	"ibm_quantum_token" = "<YOUR_TOKEN>",
	"ibm_quantum_instance" = "<INSTANCE_CRN>",
}
shots = 1000
Instead of adding the correct credentials to the options every time, consider saving them using save_aws_credentials() or save_ibm_credentials()
3

Execute your workload with error mitigation

Finally, you can use haiqu.run to execute your circuits and add error mitigation. You can then check on the job progress and retrieve the results after it is completed. Note that it is also possible to directly specify device_id keyword instead of initializing the device first.
job = haiqu.run(
		circuits=circuit,
		device=device,
		options=options,
		shots=shots,
		use_mitigation=True, # this is where we toggle error mitigation
	  )

job.progress()

print(job.result())
Haiqu SDK automatically detects whether your workload has an observable and applies the appropriate set of error mitigation tools.

Error Mitigation Details

ObservableDistribution
Supported backendsIBM QPUs, AWS Braket (TBD)IBM QPUs, AWS Braket (TBD)
Circuit formatQiskit QuantumCircuitQiskit QuantumCircuit
Max. qubit numberup to 156 qubits (largest QPU)up to 156 (diminished efficiency with sampling)
Max. circuit depth / gate countup to 1000 2q gates for up to weight-5 observables, up to 300 2q gates for non-local observables
Circuit overhead2x circuit overhead per unique circuitConstant overhead per job (noise learning)
Shot overhead2x shot overhead per unique circuitConstant overhead (noise learning)
Execution speedO(1) seconds for QEM + execution time on QPUO(1) seconds for QEM + execution time on QP