Haiqu.state_compression(circuit=None, circuits=None, compression_level=‘balanced’, noise_profile=‘default’, fine_tuning=‘low’, approximation_level=None)
Compress an arbitrary quantum circuit. Haiqu’s state compression is an approximate fixed-input-state compilation method to extend the effective depth of circuits that can be executed on noisy hardware. It features several tunable parameters to adjust the trade-off between compression level and circuit quality, allowing the user to tailor the compression to the circuit and device noise characteristics. Both the input and output circuits are assumed to be applied to the all-zero state (|00⋯0⟩). The action of the circuit on other input states is not preserved by the compression.- Parameters:
- circuit (QuantumCircuit | CircuitModel) — Deprecated. The quantum circuit to be compressed. Circuit must have no more than 1000 qubits.
- circuits (list *[*QuantumCircuit ] | list *[*CircuitModel ]) — The quantum circuit(s) to be compressed.
-
compression_level (str) —
The qualitative compression level. Increased compression level will lead to
larger part of the input circuit being compressed.
Three options are available:
- “low”: best used for shallow input circuits or very low noise levels
- “balanced” (default): gives the best performance for most circuits and noise profiles
- “high”: may sometimes yield better results for very deep circuits
- noise_profile (str) — The device noise profile to assume during compression. The currently available options are: “ibm_eagle_r3”, “ibm_heron_r1”, “ibm_heron_r2” (default), “ibm_heron_r3”, “iqm_garnet” and “iqm_emerald”. Used to automatically set the approximation level.
-
fine_tuning (str) —
The extent to which classical resources should be used to further improve the compressed circuit.
Three options are available:
- “disabled”: no fine-tuning is performed, yielding the lowest latency
- “low” (default): best balance between speed and accuracy
- “heavy”: improved circuit accuracy, but time-intensive
-
approximation_level (int | None) — A small integer related to circuit complexity. Larger values improve the noiseless
quality metric, but may degrade noisy performance. Defaults to
None, which corresponds to auto-selection using the chosennoise_profile. Can be set from 1 (very weak approximation) to 8 (very high approximation). Larger approximation level values lead to slower fine-tuning.
- Returns:
The State Compression job(s) that will generate the
: compressed circuit(s).
Call
job.result()to retrieve the compressed circuit as aCircuitModel.job.qualityis the compression quality, computed in a noiseless setting;job.infoexposes compression metadata (compression_quality,success,compression_status,compression_time,compression_percent,approximation_level). Usejob.progress()for live status updates andhelp(job.result)for the full description of result andinfocontents. - Return type: StateCompressionJobModel | list[StateCompressionJobModel]
Examples
Generate a circuit:Haiqu.state_compression_2d(circuit=None, circuits=None, device=None, device_id=None, compression_level=‘balanced’, noise_profile=None, fine_tuning=‘disabled’, approximation_level=None)
Compress an arbitrary quantum circuit on a targeted device. 2D state compression follows the topology of a device and produces an already transpiled circuit.NOTE
2D state compression is currently limited to heavy hex devices. Haiqu’s 2D state compression is an approximate fixed-input-state compilation method to extend the effective depth of circuits that can be executed on noisy hardware. It features several tunable parameters to adjust the trade-off between compression level and circuit quality, allowing the user to tailor the compression to the circuit and device noise characteristics. Both the input and output circuits are assumed to be applied to the all-zero state (|00⋯0⟩). The action of the circuit
on other input states is not preserved by the compression.
- Parameters:
- circuit (QuantumCircuit | CircuitModel) — Deprecated. The quantum circuit to be compressed. The circuit size must not exceed device’s size.
- circuits (list *[*QuantumCircuit ] | list *[*CircuitModel ]) — The quantum circuit(s) to be compressed.
-
device (DeviceModel | None) — The target device for compression. If specified,
device_idis ignored. -
device_id (str | None) — The ID of the target device for compression. Defaults to
None. -
compression_level (str) —
The qualitative compression level. Increased compression level will lead to
larger part of the input circuit being compressed.
Three options are available:
- “low”: best used for shallow input circuits or very low noise levels
- “balanced” (default): gives the best performance for most circuits and noise profiles
- “high”: may sometimes yield better results for very deep circuits
- noise_profile (str | None) — The device noise profile to use during compression. See state_compression options. By default (None) the noise profile is automatically chosen to match the device. Used to automatically set the approximation level.
-
fine_tuning (str) —
The extent to which classical resources should be used to further improve the compressed circuit.
Three options are available:
- “disabled” (default): no fine-tuning is performed, yielding the lowest latency
- “low”: best balance between speed and accuracy
- “heavy”: improved circuit accuracy, but time-intensive
-
approximation_level (int | None) — A small integer related to circuit complexity. Larger values improve the noiseless
quality metric, but may degrade noisy performance. Defaults to
None, which corresponds to auto-selection using the chosennoise_profile. Can be set from 1 (very weak approximation) to 8 (very high approximation). Larger approximation level values lead to slower fine-tuning.
- Returns:
The State Compression job(s) that will generate the
: compressed circuit(s).
Call
job.result()to retrieve the compressed circuit as aCircuitModel, already transpiled to the target device topology.job.qualityis the compression quality, computed in a noiseless setting;job.infoexposes compression metadata (compression_quality,success,compression_status,compression_time,compression_percent,approximation_level). Usejob.progress()for live status updates andhelp(job.result)for the full description of result andinfocontents. - Return type: StateCompressionJobModel | list[StateCompressionJobModel]