haiqu.flow.
Flow vs. run
haiqu.run executes circuits through one fixed, built-in pipeline controlled
by keyword flags (use_mitigation, use_packing, …). haiqu.flow runs a pipeline that you
compose layer by layer, so you control which steps run and in what order. Both accept the same
circuits, parameters, and observables, and both return a job whose result() follows the same
nested-list ordering.
Anatomy of a program
Every program starts with anInputLayer (the entry point for your circuits) and ends with a
DeviceLayer (the backend that runs them). Anything in between is optional processing. The
smallest valid program just feeds circuits straight to a device:
- The first layer must be an
InputLayer, and the last must be aDeviceLayer. - There is exactly one of each — no
InputLayerorDeviceLayerin the middle. - At most one grouped error-mitigation layer (
EstimatorLayerorDistributionMitigationLayer); the two are mutually exclusive.
The layer catalog
| Layer | Purpose | Key parameters |
|---|---|---|
InputLayer | Entry point; every program starts with one. | — |
TranspilationLayer | Transpile the circuits for the target backend. | optimization_level (0–3) |
PackingLayer | Pack several copies of a circuit into one run to use spare device qubits. | pack_size (≥ 2) |
EstimatorLayer | Measure observable expectation values with error mitigation. | mitigation flags |
DistributionMitigationLayer | Mitigate errors on the raw measured distribution. | mitigation flags |
DeviceLayer | Run the circuits on a backend; every program ends with one. | device_id, options |
TranspilationLayer() uses the
backend’s default optimization level, and PackingLayer() picks a pack size automatically).
Handling observables. A program that supplies observables must include a layer that computes
them — either the grouped
EstimatorLayer (expectation values with error mitigation) or the
fine-grained ObservableSplitLayer → QWCComputeLayer pair. When you read the raw measurement
distribution instead (no observables), reach for DistributionMitigationLayer. A program uses at
most one grouped mitigation layer — EstimatorLayer or DistributionMitigationLayer.ObservableSplitLayer and QWCComputeLayer compute observables, while NoiseTailoringLayer,
DynamicalDecouplingLayer, and AdvancedReadoutMitigationLayer apply individual mitigation
techniques. See the hybrid program reference for every layer and its
fields.
Next steps
Building and running flows
Compose a program from layers and execute it with
haiqu.flow, step by step.haiqu.login and
start an experiment — see the Get Started guide.