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 corresponding flaguse_mitigation=True in the haiqu.run function.
Haiqu applies different mitigation strategies depending on your workload type. Specify your circuits with measurements to get a mitigated distribution (bitstring counts), or supply an observable to get a mitigated expectation value. Both modes share the same flag — the SDK detects the right strategy automatically.
Distribution Mitigation
When your circuit includes measurements and you are sampling bitstrings, Haiqu performs noise learning alongside your circuit execution and uses it to correct the returned shot distribution.1
Prepare your circuit
Define your circuit and add measurements so the backend returns a shot distribution.
2
Specify execution details
Set your target device, credentials, and number of shots.
3
Run with error mitigation
Pass
use_mitigation=True to haiqu.run. The SDK applies the distribution-mode mitigation pipeline automatically.Observable Mitigation
When your circuit targets an expectation value — for example in VQE, QAOA, or Hamiltonian ground-state estimation — supply a Pauli observable instead of terminal measurements. Haiqu applies a dedicated mitigation pipeline suited to expectation values. This mode incurs 2× circuit and shot overhead per unique circuit to perform the necessary noise characterization at the observable level.1
Prepare your circuit and observable
Define your circuit without terminal measurements, and specify the Pauli observable to evaluate.
2
Specify execution details
Set your target device, credentials, and number of shots.
3
Run with error mitigation
Pass both
observables and use_mitigation=True. The SDK detects the observable and selects the appropriate mitigation pipeline automatically.Fine-Tuning with Error Mitigation Options
Both distribution and observable modes support per-component control through the optional"error_mitigation_options" key inside options. Each flag is a boolean and has a sensible default — you only need to include the flags you want to override.
Example — enabling noise tailoring while keeping all other defaults: