# Haiqu AgenticOS Source: https://docs.haiqu.ai/agentic-os The first agentic operating system for Quantum R\&D teams. [Learn more →](https://haiqu.ai/agenticos) What took your team weeks now takes hours, as specialized AI agents investigate, build, test, and run quantum experiments end-to-end, visible and verifiable at every step. > **Structured Workflow** > > Turn a research question into a structured workflow of specialized agent teams, with every dependency and decision visible. > **Verified Results** > > Every stage produces artifacts you can inspect, version, and test, so nothing moves forward without your approval. > **Human-in-the-Loop** > > Scientists direct every consequential decision, so AgenticOS accelerates the work without taking it out of your hands. ## Case studies > **[Tracing a quantum experiment with specialist agents](https://haiqu.ai/case-study/how-agenticos-coordinates-specialist-scientific-agents-to-build-test-and-trace-a-quantum-experiment-from-small-research-idea-to-result)** > > Read the paper accepted at the NeurIPS 2026 workshop. > **[The Hubbard Model on real quantum hardware](https://haiqu.ai/case-study/the-hubbard-model-on-real-quantum-hardware-doped-frustrated-and-fully-interacting)** > > Doped, frustrated, and fully interacting with diagonal hopping. > **[Designing a novel quantum optimization scheme](https://haiqu.ai/case-study/haiqu-agenticos-helps-design-novel-quantum-optimization-algorithm-scheme)** > > A population-based optimization workflow, simulated at 100-qubit scale. [View all case studies →](https://haiqu.ai/case-studies) > **[Start now](https://haiqu.ai/contactform)** > > Get in touch and we'll set you up. # Backpropagate Observables Source: https://docs.haiqu.ai/api-reference/backpropagate-observables https://api.haiqu.ai/openapi.json post /circuits/{circuit_id}/backpropagate_observables Submit a job to backpropagate observables through the circuit. Args: circuit_id (str): ID of the circuit. user (User): User authenticated with api key. data (SubmitObservableBackpropagationModel): Observables to backpropagate. Returns: Response: 200 if OK, 404 if no such circuit exists. # Build Lr Qaoa Circuit Source: https://docs.haiqu.ai/api-reference/build-lr-qaoa-circuit https://api.haiqu.ai/openapi.json post /circuits/lr_qaoa Build an LR-QAOA circuit for an unconstrained binary polynomial (synchronous). Generates the LR-QAOA circuit immediately and returns it. Args: user (User): User authenticated with api key. data (LRQAOACircuitSubmitModel): Circuit generation parameters. db (Session): The database session. Returns: CircuitModel: The generated circuit. # Collect Csp Report Source: https://docs.haiqu.ai/api-reference/collect-csp-report https://api.haiqu.ai/openapi.json post /csp Collect a Content-Security-Policy violation report. Accepts the ``application/csp-report`` and ``application/reports+json`` payloads emitted by browsers (and plain JSON), logs the report, and always returns ``204 No Content``. Report ingestion never returns an error status, to avoid noisy browser retries and to keep this unauthenticated path inert. >>> POST /csp Args: request: Incoming request carrying the browser's CSP report body. Returns: Response: Empty ``204 No Content`` response. # Compute Analytics Source: https://docs.haiqu.ai/api-reference/compute-analytics https://api.haiqu.ai/openapi.json post /circuits/{circuit_id}/compute_analytics/{analytics_type} Explicitly fire the job to compute analytics on the backend. This is useful for the Haiqu-generated circuit (data loading, hemistich) when analytics metrics are not computed. Args: circuit_id (str): ID of the circuit. user (User): User authenticated with api key. analytics_type (AnalyticsType): The type of metrics to compute. Returns: Response: 200 if OK, 404 if no such circuit exists. # Create Experiment Source: https://docs.haiqu.ai/api-reference/create-experiment https://api.haiqu.ai/openapi.json post /experiments Create experiment endpoint. Args: user (User): User authenticated with api key. data (ExperimentSubmitModel): New experiment data. Returns: Experiment: ID, name, dashboard URL of the new experiment. # Delete Circuit Source: https://docs.haiqu.ai/api-reference/delete-circuit https://api.haiqu.ai/openapi.json delete /circuits/{circuit_id} Delete circuit. Args: circuit_id (str): ID of the circuit. user (User): User authenticated with api key. Returns: Response: 200 if OK, 404 if no such circuit exists. # Delete Experiment Source: https://docs.haiqu.ai/api-reference/delete-experiment https://api.haiqu.ai/openapi.json delete /experiments/{experiment_id} Delete experiment action endpoint. Args: experiment_id (str): ID of the experiment. user (User): User authenticated with api key. Returns: Response: 200 if OK, 404 if no such experiment exists. # Get Analytics Source: https://docs.haiqu.ai/api-reference/get-analytics https://api.haiqu.ai/openapi.json get /circuits/{circuit_id}/metrics Get circuit analytics. Args: circuit_id (str): ID of the circuit. user (User): User authenticated with api key. Returns: CircuitAnalyticsModel: Metrics data. # Get Circuit Source: https://docs.haiqu.ai/api-reference/get-circuit https://api.haiqu.ai/openapi.json get /circuits/{circuit_id} Get circuit by ID. Args: circuit_id (str): ID of the circuit. user (User): User authenticated with api key. Returns: CircuitModel: Circuit object. # Get Circuit By Hash Source: https://docs.haiqu.ai/api-reference/get-circuit-by-hash https://api.haiqu.ai/openapi.json get /experiments/{experiment_id}/circuits/{circuit_hash} Get circuit by HASH. Args: experiment_id (str): The parent experiment ID. circuit_hash (str): The HASH of the circuit. user (User): User authenticated with api key. Returns: CircuitModel: Circuit object. # Get Device Endpoint Source: https://docs.haiqu.ai/api-reference/get-device-endpoint https://api.haiqu.ai/openapi.json get /devices/{device_id} Get device endpoint. Returns device information for a given device ID. Args: device_id (str): ID of the Device. user (User): User authenticated with api key. db (Session): Database session. Returns: DeviceModel: The DeviceModel object. # Get Device Gate Map Source: https://docs.haiqu.ai/api-reference/get-device-gate-map https://api.haiqu.ai/openapi.json get /devices/{device_id}/gate_map Get data for device visualization. Args: device_id (str): ID of the Device. user (User): User authenticated with api key. Returns: StreamingResponse: Image PNG data. # Get Experiment Source: https://docs.haiqu.ai/api-reference/get-experiment https://api.haiqu.ai/openapi.json get /experiments/{experiment_id} Get experiment endpoint. Args: experiment_id (str): ID of the experiment. user (User): User authenticated with api key. Returns: ExperimentModel: Experiment object. # Get Metrics Evolution Source: https://docs.haiqu.ai/api-reference/get-metrics-evolution https://api.haiqu.ai/openapi.json get /circuits/{circuit_id}/metrics_evolution Get data for metrics evolution. Args: circuit_id (str): ID of the circuit. user (User): User authenticated with api key. Returns: list[CircuitAnalyticsModel]: Metrics evolution data. # Init Experiment Source: https://docs.haiqu.ai/api-reference/init-experiment https://api.haiqu.ai/openapi.json post /experiments/init Initialize experiment endpoint. Args: user (User): User authenticated with api key. data (ExperimentSubmitModel): New experiment data. Returns: ExperimentModel: Information about the experiment. # List Artifacts Source: https://docs.haiqu.ai/api-reference/list-artifacts https://api.haiqu.ai/openapi.json get /experiments/{experiment_id}/artifacts List the artifacts logged to an experiment. Every entry in ``experiment.metrics`` is exposed as an artifact, including its inferred type and data. Args: experiment_id (str): ID of the parent experiment. user (User): User authenticated with api key. db (Session): Database session. limit (int): Limit the number of the artifacts returned. Returns: list: List of ArtifactModel objects. # List Circuits Source: https://docs.haiqu.ai/api-reference/list-circuits https://api.haiqu.ai/openapi.json get /experiments/{experiment_id}/circuits List experiment's circuits endpoint. Returns user's jobs list. Args: experiment_id: the ID of the parent experiment. user (User): User authenticated with api key. db (Session): Database session. circuit_ids (list[str] | None): When specified, filter out only specific circuits. job_type (JobType | None): When specified, filter out only circuits that belong to specific job type. limit (int): Limit the number of the circuits returned. Returns: list: List of CircuitModel objects. # List Devices Endpoint Source: https://docs.haiqu.ai/api-reference/list-devices-endpoint https://api.haiqu.ai/openapi.json get /devices List devices endpoint. Returns all registered devices with their statuses. Args: user (User): User authenticated with api key. Returns: list: List of DeviceModel objects. # List Experiments Source: https://docs.haiqu.ai/api-reference/list-experiments https://api.haiqu.ai/openapi.json get /experiments List user's experiments endpoint. Args: user (User): User authenticated with api key. name (str): Optional, experiment name to filter by. Returns: list: List of Experiment objects. # List Jobs Source: https://docs.haiqu.ai/api-reference/list-jobs https://api.haiqu.ai/openapi.json get /experiments/{experiment_id}/jobs List the jobs for the experiment or the circuit. Returns the list of the jobs. Args: experiment_id: The ID of the parent experiment. user (UserModel): User authenticated with api key. job_type (JobType | None): When specified, filter out only specific jobs. circuit_id (str | None): When specified, filter the jobs that belong to the circuit. limit (int): Limit the number of the jobs returned. Returns: list: List of job objects. # Post Metrics Source: https://docs.haiqu.ai/api-reference/post-metrics https://api.haiqu.ai/openapi.json post /experiments/{experiment_id}/circuits/{circuit_hash}/metrics Post user-defined metrics data for the circuit. Args: experiment_id (str): The parent experiment ID. circuit_hash (str): The HASH of the circuit. user (User): User authenticated with api key. Returns: 200 OK. # Post Metrics Source: https://docs.haiqu.ai/api-reference/post-metrics-1 https://api.haiqu.ai/openapi.json post /experiments/{experiment_id}/metrics Post metrics data for experiment. Args: experiment_id (str): ID of the experiment. user (User): User authenticated with api key. Returns: 200 OK. # Submit Circuit Source: https://docs.haiqu.ai/api-reference/submit-circuit https://api.haiqu.ai/openapi.json post /circuits Create circuit endpoint. Args: user (User): User authenticated with api key. Returns: CircuitModel: The new circuit object. # Transpile Circuit Source: https://docs.haiqu.ai/api-reference/transpile-circuit https://api.haiqu.ai/openapi.json post /circuits/transpile Transpile a circuit to a given device. Args: user (User): User authenticated with api key. data (SubmitTranspilationModel): Transpilation options. db (Session): The database session. Returns: TranspilationJobModel: The new job object. # Update Experiment Source: https://docs.haiqu.ai/api-reference/update-experiment https://api.haiqu.ai/openapi.json put /experiments/{experiment_id} Update an existing experiment endpoint. Args: experiment_id (str): ID of the experiment. user (User): User authenticated with api key. data (ExperimentUpdateModel): Fields to update. Returns: ExperimentModel: Experiment object. # Characteristic Functions Source: https://docs.haiqu.ai/catalog/characteristic_functions Load probability density functions of financial, physical, and heavy-tail distributions into quantum states using characteristic functions. ## Supported Characteristic Functions Haiqu SDK supports loading probability density functions from **characteristic functions (CFs)** directly into quantum states. Many distributions — across finance, physics, queuing theory, and heavy-tail modelling — are most naturally specified through their CF $\phi(u) = \mathbb{E}[e^{iuX}]$ because their PDF has no closed form or is analytically intractable. Load the PDF of any supported distribution via its characteristic function using: ```python theme={null} data_loading_gate = haiqu.distribution_loading( distribution_name="cf_name", # characteristic function name (e.g. "heston_cf") num_qubits=8, interval_start=-3, interval_end=3, # model-specific parameters — see each section below **kwargs ).result() ``` The functions are organized into three branches: | Branch | Models | | :- | :- | | AJD (Affine Jump-Diffusion) | `heston_cf` → `bates_cf` → `svjj_cf` → `dps_cf` (each extends the previous) | | Lévy-OU (OU subordinator clock) | `bns_cf` | | Pure Lévy (Lévy–Khintchine) | `holtsmark_cf`, `landau_cf`, `cgmy_cf`, `meixner_cf`, `linnik_cf`, `variance_gamma_cf`, `bilateral_gamma_cf`, `compound_poisson_cf`, `levy_khintchine_cf` | *** ## AJD Branch The AJD (Affine Jump-Diffusion) branch models $\log S_T$ as Heston stochastic volatility with optional independent jump sources. `dps_cf` is the most general model; all others are obtained by zeroing parameters. ### Heston Model **Name in SDK:** `heston_cf`  |  **Citation:** [Heston (1993)](https://doi.org/10.1093/rfs/6.2.327)  |  **PDF support:** $(-\infty,\, \infty)$ The industry-standard stochastic volatility model. Its mean-reverting variance process captures the volatility smile without jumps, is analytically tractable, and calibrates efficiently to vanilla option surfaces — making it the natural first choice for equity and foreign exchange derivatives. $\phi(u) = \exp\bigl(iu\log S_0 + C(u) + D(u)\,v_0\bigr)$ The Riccati coefficients $C$ and $D$ are solved in the numerically stable form of [Albrecher et al. (2007)](https://www.researchgate.net/publication/228664682_The_Little_Heston_Trap). Define the intermediate quantities $\xi = \kappa - \rho\sigma\, iu, \qquad d = \sqrt{\xi^2 + \sigma^2(u^2 + iu)}, \qquad g = \frac{\xi - d}{\xi + d}$ then $C(u) = (r-q)\,iu\,T \;+\; \frac{\kappa\theta}{\sigma^2}\left[(\xi - d)\,T - 2\ln\frac{1 - g\,e^{-dT}}{1 - g}\right]$ $D(u) = \frac{\xi - d}{\sigma^2}\cdot\frac{1 - e^{-dT}}{1 - g\,e^{-dT}}$ $C$ captures the cumulative drift and mean-reversion cost over $[0,T]$; $D$ is the sensitivity of the log-CF to the current variance $v_0$, decaying toward zero as the variance mean-reverts to $\theta$. | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `S0` | `float` | $S_0 > 0$ | Spot price | | `v0` | `float` | $v_0 > 0$ | Initial variance | | `T` | `float` | $T > 0$ | Time to maturity in years | | `r` | `float` | $r \in \mathbb{R}$ | Risk-free rate | | `q` | `float` | $q \in \mathbb{R}$ | Continuous dividend yield | | `kappa` | `float` | $\kappa > 0$ | Mean-reversion rate | | `theta` | `float` | $\theta > 0$ | Long-term variance | | `sigma` | `float` | $\sigma > 0$ | Volatility-of-volatility | | `rho` | `float` | $\rho \in (-1, 1)$ | Asset–variance correlation | > [!NOTE] > > The Feller condition $2\kappa\theta > \sigma^2$ ensures the variance process $v_t$ remains strictly positive. If violated, $v_t$ can hit zero and the characteristic function may become numerically unreliable. ```python theme={null} data_loading_gate = haiqu.distribution_loading( distribution_name="heston_cf", num_qubits=8, interval_start=-3, interval_end=3, S0=100.0, # initial asset price v0=0.04, # initial variance T=1.0, # time to maturity (years) r=0.05, # risk-free rate q=0.0, # dividend yield kappa=2.0, # mean-reversion rate theta=0.04, # long-run variance sigma=0.3, # vol-of-vol rho=-0.7, # asset-variance correlation ).result() ``` ### Bates Model **Name in SDK:** `bates_cf`  |  **Citation:** [Bates (1996)](https://doi.org/10.1093/rfs/9.1.69)  |  **PDF support:** $(-\infty,\, \infty)$ Extends Heston with independent log-normal price jumps, capturing the steep short-maturity skew that pure diffusion cannot reproduce. The standard model for equity index options where crash risk matters. $\phi_{\text{Bates}}(u) = \phi_{\text{Heston}}(u) \cdot \exp\Bigl(\lambda T\bigl(e^{iu\mu_j - \frac{1}{2}\sigma_j^2 u^2} - 1 - iu\bar\mu\bigr)\Bigr)$ where $\bar\mu = e^{\mu_j + \frac{1}{2}\sigma_j^2} - 1$ is the martingale drift correction that keeps $e^{(r-q)T}S_0$ as the forward price. **Additional parameters** (inherits all Heston parameters): | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `lam` | `float` | $\lambda \geq 0$ | Jump intensity (jumps/year) | | `mu_j` | `float` | $\mu_j \in \mathbb{R}$ | Mean of log-jump $\ln(1+k)$ | | `sigma_j` | `float` | $\sigma_j > 0$ | Std of log-jump $\ln(1+k)$ | ```python theme={null} data_loading_gate = haiqu.distribution_loading( distribution_name="bates_cf", num_qubits=8, interval_start=-3, interval_end=3, S0=100.0, v0=0.04, T=1.0, r=0.05, q=0.0, kappa=2.0, theta=0.04, sigma=0.3, rho=-0.7, lam=0.5, # jump intensity (jumps/year) mu_j=-0.05, # mean log jump size sigma_j=0.1, # std of log jump size ).result() ``` ### SVJJ Model **Name in SDK:** `svjj_cf`  |  **Citation:** [Duffie, Pan & Singleton (2003)](https://doi.org/10.1111/1468-0262.00164), [Eraker (2003)](https://doi.org/10.1111/1540-6261.00566)  |  **PDF support:** $(-\infty,\, \infty)$ Extends Bates with independent exponential variance jumps, allowing volatility to spike discretely alongside price crashes. Empirically important for fitting the joint dynamics of the spot and VIX surfaces around market stress events. $\phi_{\text{SVJJ}}(u) = \phi_{\text{Bates}}(u) \cdot \exp(c_{vj})$ where $D(u,s)$ is the Heston $D$ coefficient evaluated at remaining time $s$ rather than the full maturity $T$: $D(u,s) = \frac{\xi - d}{\sigma^2}\cdot\frac{1 - e^{-ds}}{1 - g\,e^{-ds}}$ The variance-jump contribution integrates the moment-generating function of an exponential jump against this time-varying coefficient: $c_{vj} = \lambda_v \int_0^T \left[\frac{1}{1 - \mu_v D(u,s)} - 1\right] ds$ The integrand is the CGF of one exponential($1/\mu_v$) variance jump evaluated at $D(u,s)$; the integral is evaluated in closed form. **Additional parameters** (inherits all Bates parameters): | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `lam_v` | `float` | $\lambda_v \geq 0$ | Variance jump intensity | | `mu_v` | `float` | $\mu_v > 0$ | Mean of exponential variance jump | ```python theme={null} data_loading_gate = haiqu.distribution_loading( distribution_name="svjj_cf", num_qubits=8, interval_start=-3, interval_end=3, S0=100.0, v0=0.04, T=1.0, r=0.05, q=0.0, kappa=2.0, theta=0.04, sigma=0.3, rho=-0.7, lam=0.5, mu_j=-0.05, sigma_j=0.1, lam_v=0.3, # variance jump intensity mu_v=0.05, # mean of exponential variance jump ).result() ``` ### DPS Model (most general AJD) **Name in SDK:** `dps_cf`  |  **Citation:** [Duffie, Pan & Singleton (2003)](https://doi.org/10.1111/1468-0262.00164)  |  **PDF support:** $(-\infty,\, \infty)$ Extends SVJJ with a third correlated jump source: simultaneous price and variance jumps whose sizes are statistically dependent. All narrower AJD models are special cases obtained by zeroing parameters. $\phi_{\text{DPS}}(u) = \phi_{\text{SVJJ}}(u) \cdot \exp(c_{\text{corr}})$ where $D(u,s)$ is defined as in the SVJJ section, and the correlated-jump contribution accounts for the joint distribution of a price jump $J_S \mid J_v \sim \mathcal{N}(\mu_j + \rho_j J_v,\, \sigma_j^2)$ and a variance jump $J_v \sim \mathrm{Exp}(1/\mu_v)$: $c_{\text{corr}} = \lambda_c \int_0^T \left[\frac{K}{c - \mu_v D(u,s)} - 1 - iu\bar\mu_c\right] ds$ with $K = e^{iu\mu_j - \frac{1}{2}\sigma_j^2 u^2}$, $c = 1 - \mu_v\, iu\,\rho_j$, and $\bar\mu_c = e^{\mu_j + \frac{1}{2}\sigma_j^2}/(1 - \rho_j\mu_v) - 1$. The integral is evaluated in closed form. **Additional parameters** (inherits all SVJJ parameters): | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `lam_c` | `float` | $\lambda_c \geq 0$ | Correlated jump intensity | | `rho_j` | `float` | $\rho_j \in \mathbb{R}$ | Sensitivity of mean price jump to variance jump size | ```python theme={null} data_loading_gate = haiqu.distribution_loading( distribution_name="dps_cf", num_qubits=8, interval_start=-3, interval_end=3, S0=100.0, v0=0.04, T=1.0, r=0.05, q=0.0, kappa=2.0, theta=0.04, sigma=0.3, rho=-0.7, lam=0.5, mu_j=-0.05, sigma_j=0.1, # independent price jumps lam_v=0.3, mu_v=0.05, # independent variance jumps lam_c=0.2, rho_j=0.5, # correlated jumps ).result() ``` | Model | Zeroed parameters | | :- | :- | | `svjj_cf` | `lam_c=0`, `rho_j=0` | | `bates_cf` | `lam_c=0`, `rho_j=0`, `lam_v=0` | | `heston_cf` | `lam_c=0`, `rho_j=0`, `lam_v=0`, `lam=0` | *** ## Lévy-OU Branch ### BNS Model **Name in SDK:** `bns_cf`  |  **Citation:** [Barndorff-Nielsen & Shephard (2001)](https://www.jstor.org/stable/2680596)  |  **PDF support:** $(-\infty,\, \infty)$ Drives variance through a non-Gaussian Ornstein–Uhlenbeck process subordinated to a Lévy process (e.g. Gamma). This produces heavier tails than Heston and naturally accommodates the empirically observed non-Gaussian distribution of variance increments, making it particularly suited to energy and commodity markets. $\phi(u) = \exp\bigl(iu\log S_0 + iu(r-q)T + A(u) + B(u)\,\sigma^2_0\bigr)$ Here $u \in \mathbb{R}$ is the Fourier argument, i.e. $\phi(u) = \mathbb{E}[e^{iu\log S_T}]$. **$B(u,s)$** — sensitivity to the initial variance $\sigma^2_0$, obtained by integrating the OU impulse-response function against the standard risk-neutral price–variance loading ($\beta = -\tfrac{1}{2}$ baked in). Here $s$ is the remaining time, so $B(u,s)$ evaluated at $s = T$ gives the full-horizon coefficient: $B(u,s) = -\frac{u^2 + iu}{2\lambda}\left(1 - e^{-\lambda s}\right)$ As $s \to \infty$, $B \to -(u^2+iu)/(2\lambda)$; the initial variance is "forgotten" at rate $\lambda$. **$A(u)$** — cumulative contribution from the subordinator's Lévy measure, obtained by integrating the log-Laplace exponent $\Psi_Z$ of the subordinator along the shifted $B$-curve: $A(u) = \int_0^T \Psi_Z\bigl(B(u,s) + iu\rho\bigr)\, ds$ The additive $iu\rho$ inside $\Psi_Z$ is the direct jump leverage: it correlates price jumps with variance jumps instantaneously. Set $\rho = 0$ to disable this channel. The Lévy time-change factor $\lambda$ from the paper is absorbed into the subordinator parameters $a$ and $b$ rather than appearing explicitly outside the integral. For the Gamma subordinator with shape $a$ and rate $b$: $\Psi_Z(\theta) = -a\ln\left(1 - \frac{\theta}{b}\right)$ This integral has no closed form in general and is evaluated by numerical quadrature (controlled by parameter `n`). | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `S0` | `float` | $S_0 > 0$ | Initial asset price | | `sigma0_sq` | `float` | $\sigma_0^2 > 0$ | Initial variance $\sigma^2(0)$ | | `T` | `float` | $T > 0$ | Time to maturity | | `r` | `float` | $r \in \mathbb{R}$ | Risk-free rate | | `q` | `float` | $q \in \mathbb{R}$ | Dividend yield | | `lam` | `float` | $\lambda > 0$ | OU mean-reversion rate | | `rho` | `float` | $\rho \in \mathbb{R}$ | Direct jump leverage; correlates price and variance jumps instantaneously (default `0.0`) | | `subordinator` | `str` | `"gamma"` | Subordinator type — currently `"gamma"` only | | `a` | `float` | $a > 0$ | Gamma shape (absorbs the $\lambda$ time-change factor from the paper) | | `b` | `float` | $b > 0$ | Gamma rate | | `n` | `int` | $n \geq 1$ | Quadrature steps for $A(u)$ (default `200`) | ```python theme={null} data_loading_gate = haiqu.distribution_loading( distribution_name="bns_cf", num_qubits=8, interval_start=-3, interval_end=3, S0=100.0, sigma0_sq=0.04, # initial variance σ²(0) T=1.0, r=0.05, q=0.0, lam=2.0, # OU mean-reversion rate rho=-0.5, # direct jump leverage subordinator="gamma", a=1.0, # Gamma shape b=10.0, # Gamma rate n=200, # quadrature steps ).result() ``` > [!NOTE] > > Only the `'gamma'` subordinator is currently supported. Increase `n` for higher precision at longer maturities. *** ## Pure Lévy Processes ### CGMY / Tempered Stable **Name in SDK:** `cgmy_cf`  |  **Citation:** [Carr, Geman, Madan & Yor (2002)](https://www.jstor.org/stable/10.1086/338705)  |  **PDF support:** $(-\infty,\, \infty)$ A four-parameter pure-jump Lévy model that nests Variance Gamma ($Y \to 0$) and approaches Brownian motion as $Y \to 2$. The fine-structure index $Y$ directly controls whether the process has finite or infinite variation, making CGMY the go-to model for studying jump activity in high-frequency return data. $\phi(u) = \exp\bigl(C\,\Gamma(-Y)\bigl[(M - iu)^Y - M^Y + (G + iu)^Y - G^Y\bigr]\bigr)$ | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `C` | `float` | $C > 0$ | Overall jump activity | | `G` | `float` | $G > 0$ | Exponential decay rate for negative jumps | | `M` | `float` | $M > 0$ | Exponential decay rate for positive jumps | | `Y` | `float` | $Y \in (0, 2)$, not integer | Order of asset activity | ```python theme={null} data_loading_gate = haiqu.distribution_loading( distribution_name="cgmy_cf", num_qubits=8, interval_start=-3, interval_end=3, C=1.0, # overall jump activity G=5.0, # decay for negative jumps M=8.0, # decay for positive jumps Y=0.5, # fine-structure index ∈ (0, 2), not an integer ).result() ``` > [!NOTE] > > `cgmy_cf` raises `ValueError` if `Y` is outside $(0, 2)$ or is an integer (pole of $\Gamma(-Y)$). | Special case | Distribution | | :- | :- | | $Y \to 0$ | [Variance Gamma](#variance-gamma) | | $Y \to 2$ | Brownian motion | | $G = M$ | Symmetric CGMY | *** ### Variance Gamma **Name in SDK:** `variance_gamma_cf`  |  **Citation:** [Madan, Carr & Chang (1998)](https://engineering.nyu.edu/sites/default/files/2018-09/CarrEuropeanFinReview1998.pdf)  |  **PDF support:** $(-\infty,\, \infty)$ Brownian motion with drift time-changed by a Gamma process. Produces semi-heavy tails and controllable skewness with only three parameters, making it both parsimonious and analytically convenient for calibration to vanilla options across strikes and maturities. $\phi(u) = \left(1 - i\theta\nu u + \tfrac{1}{2}\sigma^2\nu\, u^2\right)^{-1/\nu}$ | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `sigma` | `float` | $\sigma > 0$ | Brownian component volatility | | `nu` | `float` | $\nu > 0$ | Variance rate of the Gamma time-change | | `theta` | `float` | $\theta \in \mathbb{R}$ | Brownian drift (skewness control) | ```python theme={null} data_loading_gate = haiqu.distribution_loading( distribution_name="variance_gamma_cf", num_qubits=8, interval_start=-3, interval_end=3, sigma=0.2, # Brownian volatility nu=0.1, # Gamma variance rate theta=-0.1, # Brownian drift ).result() ``` *** ### Meixner Process **Name in SDK:** `meixner_cf`  |  **Citation:** [Schoutens (2001)](https://www.eurandom.tue.nl/reports/2001/002-report.pdf)  |  **PDF support:** $(-\infty,\, \infty)$ An infinite-activity pure-jump Lévy process with a closed-form characteristic function built from hyperbolic cosines. Its four parameters independently control scale, skewness, tail heaviness, and location, giving excellent flexibility for fitting option smiles while remaining computationally efficient. $\phi(u) = e^{i\mu u}\left(\frac{\cos(\beta/2)}{\cosh\left(\tfrac{\alpha u - i\beta}{2}\right)}\right)^{2\delta}$ | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `alpha` | `float` | $\alpha > 0$ | Scale | | `beta` | `float` | $\beta \in (-\pi, \pi)$ | Skewness | | `delta` | `float` | $\delta > 0$ | Shape | | `mu` | `float` | $\mu \in \mathbb{R}$ | Location shift (default `0`) | > [!NOTE] > > `meixner_cf` raises `ValueError` if `beta` is outside $(-\pi, \pi)$. ```python theme={null} data_loading_gate = haiqu.distribution_loading( distribution_name="meixner_cf", num_qubits=8, interval_start=-3, interval_end=3, alpha=0.3, # scale α > 0 beta=-0.5, # skewness β ∈ (-π, π) delta=1.0, # shape δ > 0 mu=0.0, # location (default 0) ).result() ``` *** ### Holtsmark Distribution **Name in SDK:** `holtsmark_cf`  |  **Citation:** [Holtsmark (1919)](https://doi.org/10.1002/andp.19193641503)  |  **PDF support:** $(-\infty,\, \infty)$ Special case $S(3/2,\,0,\,\gamma,\,\delta)$. Originally derived to model the gravitational field of a random stellar ensemble; its infinite variance makes it a powerful model for extreme-event phenomena in plasma physics and anomalous diffusion. $\phi(u) = \exp\bigl(iu\delta - \gamma^{3/2}|u|^{3/2}\bigr)$ **Parameters** (`alpha=1.5`, `beta=0` fixed): | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `gamma` | `float` | $\gamma > 0$ | Scale | | `delta` | `float` | $\delta \in \mathbb{R}$ | Location | ```python theme={null} data_loading_gate = haiqu.distribution_loading( distribution_name="holtsmark_cf", num_qubits=8, interval_start=-5, interval_end=5, gamma=1.0, delta=0.0, ).result() ``` *** ### Landau Distribution **Name in SDK:** `landau_cf`  |  **Citation:** [Bulyak (2022)](https://arxiv.org/abs/2209.06387)  |  **PDF support:** $(-\infty,\, \infty)$ Special case $S(1,\,1,\,\gamma,\,\delta)$ — maximally right-skewed with a heavy right tail. Originally models ionisation energy loss of charged particles in thin matter layers; in data science it appears as a model for right-skewed count data and timing jitter. $\phi(u) = \exp\Bigl(iu\delta - \gamma|u|\Bigl[1 + i\,\tfrac{2}{\pi}\,\text{sgn}(u)\ln|u|\Bigr]\Bigr)$ **Parameters** (`alpha=1`, `beta=1` fixed): | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `gamma` | `float` | $\gamma > 0$ | Scale | | `delta` | `float` | $\delta \in \mathbb{R}$ | Location | ```python theme={null} data_loading_gate = haiqu.distribution_loading( distribution_name="landau_cf", num_qubits=8, interval_start=-2, interval_end=10, gamma=1.0, delta=0.0, ).result() ``` *** ### Linnik / Geometric Stable **Name in SDK:** `linnik_cf`  |  **Citation:** [Klebanov (1985)](https://doi.org/10.1137/1129104)  |  **PDF support:** $(-\infty,\, \infty)$ The law of a geometric sum of i.i.d. stable random variables. Heavier-tailed than the corresponding stable law, making it useful for modelling waiting times in queuing, anomalous diffusion, and financial durations. The symmetric case simplifies to $\phi(u) = (1 + |u|^\alpha)^{-1}$. $\phi(u) = \frac{1}{1 - \Psi_{\text{stable}}(u)}$ where $\Psi_{\text{stable}}(u) = \ln\phi_{\text{stable}}(u)$ is the Lévy exponent of the underlying stable distribution (not the stable CF itself). | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `alpha` | `float` | $\alpha \in (0, 2]$ | Stability index | | `beta` | `float` | $\beta \in [-1, 1]$ | Skewness (default `0`) | | `gamma` | `float` | $\gamma > 0$ | Scale (default `1`) | | `delta` | `float` | $\delta \in \mathbb{R}$ | Location (default `0`) | ```python theme={null} data_loading_gate = haiqu.distribution_loading( distribution_name="linnik_cf", num_qubits=8, interval_start=-5, interval_end=5, alpha=1.5, # stability index ∈ (0, 2] beta=0.0, # skewness (default 0) gamma=1.0, # scale (default 1) delta=0.0, # location (default 0) ).result() ``` *** ### Bilateral Gamma **Name in SDK:** `bilateral_gamma_cf`  |  **Citation:** [Küchler & Tappe (2019)](https://arxiv.org/abs/1907.09857)  |  **PDF support:** $(-\infty,\, \infty)$ Decomposes log-returns into independent positive and negative Gamma jump components, each with its own shape and rate. This asymmetric structure naturally captures the empirical observation that upward and downward moves in asset prices have different statistical properties. $\phi(u) = \left(\frac{b_+}{b_+ - iu}\right)^{a_+}\left(\frac{b_-}{b_- + iu}\right)^{a_-}$ | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `a_p` | `float` | $a_+ > 0$ | Positive-jump Gamma shape | | `b_p` | `float` | $b_+ > 0$ | Positive-jump Gamma rate | | `a_m` | `float` | $a_- > 0$ | Negative-jump Gamma shape | | `b_m` | `float` | $b_- > 0$ | Negative-jump Gamma rate | ```python theme={null} data_loading_gate = haiqu.distribution_loading( distribution_name="bilateral_gamma_cf", num_qubits=8, interval_start=-3, interval_end=3, a_p=2.0, b_p=10.0, # positive-jump Gamma shape and rate a_m=1.5, b_m=8.0, # negative-jump Gamma shape and rate ).result() ``` *** ### Compound Poisson Process **Name in SDK:** `compound_poisson_cf`  |  **Citation:** [Gao (2022)](https://doi.org/10.1017/S0269964822000195)  |  **PDF support:** depends on jump type (see table below) A finite-activity pure-jump process — the simplest possible jump model. Ideal for modelling rare, large events such as sovereign defaults, catastrophe losses, or earnings announcements, where the assumption of a finite number of jumps per unit time is realistic. $\phi(u) = \exp\bigl(\lambda(\phi_X(u) - 1)\bigr)$ | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `lam` | `float` | $\lambda > 0$ | Jump intensity (jumps/year) | | `phi_x_type` | `str` | — | Jump distribution: `"gaussian"`, `"exponential"`, `"gamma"`, or `"stable"` | | `alpha` | `float` | see sub-table | Shape for `"gamma"`; stability index for `"stable"` | | `beta` | `float` | see sub-table | Rate (`"exponential"`/`"gamma"`) or skewness (`"stable"`) | | `gamma` | `float` | $\gamma > 0$ | Scale (required for `"stable"`) | | `delta` | `float` | $\delta \in \mathbb{R}$ | Location (required for `"stable"`) | | `phi_x_type` | Required kwargs | Constraints | $\phi_X(u)$ | PDF support | | :- | :- | :- | :- | :- | | `'gaussian'` | *(none — fixed to $N(0,1)$)* | — | $e^{-u^2/2}$ | $(-\infty,\, \infty)$ | | `'exponential'` | `beta` | $\beta > 0$ | $\beta\,/\,(\beta - iu)$ | $[0,\, \infty)$ | | `'gamma'` | `alpha`, `beta` | $\alpha > 0$, $\beta > 0$ | $\bigl(\beta\,/\,(\beta - iu)\bigr)^\alpha$ | $[0,\, \infty)$ | | `'stable'` | `alpha`, `beta`, `gamma`, `delta` | $\alpha \in (0, 2]$, $\beta \in [-1, 1]$ | $\phi_{S(\alpha,\beta,\gamma,\delta)}(u)$ | $(-\infty,\, \infty)$ | ```python theme={null} data_loading_gate = haiqu.distribution_loading( distribution_name="compound_poisson_cf", num_qubits=8, interval_start=-3, interval_end=3, lam=2.0, phi_x_type="gamma", **kwargs ).result() ``` > [!TIP] > > * **Model selection**: Start with `heston_cf` for equity derivatives; extend to `bates_cf` or `dps_cf` if short-maturity skew or volatility jumps are under-fitted. > * **Fidelity**: circuit fidelity depends on `num_qubits` and the fraction of PDF mass within `[interval_start, interval_end]` — increase `num_qubits` or widen the interval to improve it. > * **SciPy distributions**: For standard distributions (Normal, Beta, Gamma, …) use [Distribution Loading](/core_features/data_loading_dist) instead. # Benchmarks data sheet Source: https://docs.haiqu.ai/catalog/datasheet Specifications and benchmarks of core functions ## Error suppression & mitigation stack ### Benchmark: 2D transverse-field Ising model We reproduce the experiment from [IBM's Nature publication](https://www.nature.com/articles/s41586-023-06096-3) using Haiqu's lightweight error mitigation techniques. ![Ising Model simulation, 127 qubits, IBM Kingston](https://mintcdn.com/haiqu/dSRoSE63jQ9HbUY3/catalog/ising_evolution_127_q_Magnetization_ibm_kingston.png?fit=max\&auto=format\&n=dSRoSE63jQ9HbUY3\&q=85\&s=4f55c25679d6002ab4372f3e27685bfd) In [the paper](https://www.nature.com/articles/s41586-023-06096-3) (see Figure 3 a)), the authors used Sparse Pauli-Lindblad Noise Learning to perform zero-noise extrapolation (ZNE) with Probabilistic Error Amplification (PEA) which comes at significant overhead in terms of total number of shots (more than 100x) and number of extra circuits. > [!TIP] > > Haiqu delivers similar error suppression using essentially the same quantum resources you'd use for the raw, uncorrected experiment. Check for more details in **`IsingModelSimulation.ipynb`** notebook. ### Benchmark: GHZ state preparation We prepare GHZ states on IBM Heron r2 processor by hardware-efficient circuits (found by breadth-first search (BFS) algorithm) with Haiqu's bitstring distribution error mitigation. ![Ghz State Benchmark Pn](https://mintcdn.com/haiqu/dSRoSE63jQ9HbUY3/catalog/ghz_state_benchmark.png?fit=max\&auto=format\&n=dSRoSE63jQ9HbUY3\&q=85\&s=987d13a6db7042532f0d1b735365897a) You can reproduce the results using the `GHZStatePreparation.ipynb` notebook. ### Mitigation Loading Specifications | | Observable-based mitigation | Bitstring distribution mitigation | | - | - | - | | Supported backends | IBM QPUs, AWS Braket (TBD) | IBM QPUs, AWS Braket (TBD) | | Max number of qubits | up to 156 qubits (largest QPU) | up to 156 qubits (largest QPU) | | Max. circuit depth / gate count | up to 1000 2q gates for up to weight-5 observables, up to 300 2q gates for highly non-local observables | up to 300 2q gates | | Circuit execution overhead | 2x more circuit executions per unique circuit | 2x more circuit executions per unique circuit | | Shot overhead | 2x more shots per unique circuit | 2x more shots per unique circuit | | Execution speed | O(1) seconds for QEM + execution time on QPU | O(10) seconds for QEM + execution time on QPU | ## State compression ### Benchmark: Utility-scale LR-QAOA Following recent paper by [Montanez-Barrera et. al. "Evaluating the performance of quantum processing units at large width and depth"](https://arxiv.org/abs/2502.06471), we use linear ramp quantum approximate optimization algorithm (LR-QAOA), a fixed-parameter, deterministic variant of QAOA, as a benchmarking protocol. Haiqu's compression enables execution of nearly **20x** more layers of LR-QAOA with the increasing approximation ratio. ![LR-QAOA benchmark, 100 qubits, IBM Kingston](https://mintcdn.com/haiqu/dSRoSE63jQ9HbUY3/catalog/LR-QAOA_100_qubits_IBM_Kingston.png?fit=max\&auto=format\&n=dSRoSE63jQ9HbUY3\&q=85\&s=99b0e7efc4c92d5ec748e6f39ef1a0be) ## State Compression Specifications | **Parameter** | **Details** | | :- | :- | | **Number of qubits** | Up to 500 | | **Runtime (at 100 qubits)** | From few seconds and up to 2 minutes with no fine-tuning; up to 15 minutes with heavy fine-tuning | | **Runtime scaling** | Linear scaling with circuit size, problem-dependent | | **Supported circuits** | - Circuits decomposable into CNOT, RX, RY, RZ basis gates - Circuits with mid-circuit measurements are supported, but compression applies only prior to MCM | | **Supported connectivity** | Any. Not transpiled input with Linear connectivity is preferred. | | **Compression rate** | Up to 100× for various application circuits | | **Returned metrics** | - Compression rate - Quality of the compression (fidelity-like metric) | \*runtime can vary for different circuit classes of the same size ## Data loading ## Distribution Loading Specifications | **Parameter** | **Details** | | :- | :- | | **Number of qubits** | Up to 500 qubits | | **Number of distributions** | 107 different classes of distributions are supported. Check SciPy docs for details. | | **Runtime** | 1–15 seconds | | **Runtime scaling** | Linear scaling with number of qubits | | **Circuit size (gates count)** | O(n), n = number of qubits | | **Circuit depth** | O(n/2), n = number of qubits | | **Circuit connectivity** | Linear | | **Other circuit properties** | - No mid-circuit measurements - Only CNOT and single-qubit rotation gates - No ancillary qubits - No post-selection required in state preparation | | **Returned metrics** | Quantum state fidelity is returned for the ideal state prepared by the circuit | ### Vector Loading specifications | **Parameter** | **Details** | | :- | :- | | **Number of qubits** | Up to 20 qubits | | **Input data** | 1D vector | | **Data type** | Real and complex values | | **Data size** | Up to \~1M features in the vector | | **Runtime** | 0.5–2 minutes | | **Runtime scaling** | Linear scaling with number of qubits | | **Circuit size (gates count)** | O(n), n = number of qubits | | **Circuit depth** | O(n/2), n = number of qubits | | **Circuit connectivity** | Linear | | **Other circuit properties** | - No mid-circuit measurements - Only CNOT and single-qubit rotation gates - No ancilla qubits - No post-selection required in state preparation | | **Returned metrics** | Quantum state fidelity is returned for the ideal state prepared by the circuit | ### Block Vector Loading specifications | **Parameter** | **Details** | | :- | :- | | **Number of qubits** | 1000+ qubits; no more than 20 qubits for a single block | | **Input data** | 1D vector 2D matrix | | **Data type** | Real and complex values | | **Data size** | Any, with no more than \~1M features for a single block | | **Runtime** | 0.5–2 minutes per block | | **Runtime scaling** | Linear scaling with number of qubits | | **Circuit size (gates count)** | O(n), n = number of qubits | | **Circuit depth** | O(m/2), m = number of qubits in each block | | **Circuit connectivity** | Linear within each block | | **Other circuit properties** | - No mid-circuit measurements - Only CNOT and single-qubit rotation gates - No ancilla qubits - No post-selection required in state preparation | | **Returned metrics** | Quantum state fidelity is returned for the ideal state prepared by the circuit | # Multivariate Probability Distributions Source: https://docs.haiqu.ai/catalog/multivariate_distributions Load multidimensional probability densities and copula-based joint probability density functions into quantum states. ## Multivariate Distribution Loading Haiqu SDK supports loading named multidimensional probability density functions (PDFs) into quantum circuits with `haiqu.multivariate_distribution_loading`. ```python theme={null} job = haiqu.multivariate_distribution_loading( distribution_name="bivariate_student_t", num_qubits=8, # 4 qubits for x and 4 qubits for y interval=((-4.0, 4.0), (-4.0, 4.0)), encoding="probability", distribution_params={ "mu": [0.0, 0.0], "sigma": [[1.0, 0.3], [0.3, 1.0]], "nu": 5.0, }, ) data_loading_gate = job.result() # a HaiquCircuitGate, encapsulating state preparation circuit ``` > [!TIP] > > Circuit fidelity is stored in `job.quality`. This is the MPS-to-circuit compilation fidelity. For a $d$-dimensional distribution with $n_j$ qubits allocated to dimension $j$, the qubit layout groups dimensions sequentially: dimension $1$ occupies qubits $q^{(1)}_0, \ldots, q^{(1)}_{n_1-1}$, dimension $2$ occupies $q^{(2)}_0, \ldots, q^{(2)}_{n_2-1}$, and so on up to dimension $d$, where $q^{(j)}_0$ is the least-significant-bit qubit for dimension $j$. If `num_qubits=(n_1, ..., n_d)`, the circuit uses $n_j$ qubits for dimension $j$. Each qubit group encodes a grid index in binary: for dimension $j$, the integer index $i_j = q^{(j)}_0 \cdot 2^0 + q^{(j)}_1 \cdot 2^1 + \cdots + q^{(j)}_{n_j-1} \cdot 2^{n_j-1}$ maps to the grid point $x^{(j)}_{i_j} = \frac{\mathrm{high}_j - \mathrm{low}_j}{2^{n_j} - 1} i_j + \mathrm{low}_j \in [\mathrm{low}_j, \mathrm{high}_j].$ Qiskit uses the qubit-ordering convention $|q_{N-1}, \ldots, q_1, q_0\rangle$ (most-significant qubit on the left), so the statevector index ordering is the reverse of the layout above: the full register reads $|q^{(d)}_{n_d-1}, \ldots, q^{(d)}_0, \ldots, q^{(1)}_{n_1-1}, \ldots, q^{(1)}_0\rangle$ in Qiskit notation. ## Encoding Modes | Mode | Amplitudes | Measurement probabilities | Use case | | :- | :- | :- | :- | | `encoding="amplitude"` | proportional to the density value | proportional to the squared density value | Direct function-amplitude loading | | `encoding="probability"` | proportional to the square root of the density value | proportional to the density value | Probability distribution loading | For a $d$-dimensional grid point $\mathbf{x}_\mathbf{i} = (x^{(1)}_{i_1}, \ldots, x^{(d)}_{i_d})$ and density $f$, the two modes encode: $\psi_{\mathbf{i}}^{\mathrm{amplitude}} = \frac{f(\mathbf{x}_\mathbf{i})}{\sqrt{\sum_{\mathbf{k}} f(\mathbf{x}_\mathbf{k})^2}}$ $\psi_{\mathbf{i}}^{\mathrm{probability}} = \sqrt{\frac{f(\mathbf{x}_\mathbf{i})}{\sum_{\mathbf{k}} f(\mathbf{x}_\mathbf{k})}}$ > [!TIP] > > Use `encoding="probability"` when `distribution_name` refers to a PDF and measurement outcomes should sample from that PDF. ## Parameters | Parameter | Type | Description | | :- | :- | :- | | `distribution_name` | `str` | Name of a supported distribution or copula. | | `num_qubits` | `int` or tuple of `int` | Total qubit count split evenly across dimensions, or a per-dimension tuple `(n_1, ..., n_d)`. | | `interval` | `(a, b)` or `((a_1, b_1), ..., (a_d, b_d))` | Shared interval for all dimensions, or per-dimension intervals. Defaults to `(0, 1)`. | | `encoding` | `str` | `"amplitude"` or `"probability"`. Defaults to `"amplitude"`. | | `distribution_params` | `dict` | Parameters for direct 2D distributions. | | `copula_params` | `dict` | Parameters for a named copula. | | `marginal_distribution_names` | sequence of `str` | Two `scipy.stats` marginal names for copula-based joint PDFs. | | `marginal_distribution_params` | sequence of `dict` | Parameters for each marginal distribution. | | `num_layers` | `int` | Number of disentangler layers in MPS-to-circuit compilation. Defaults to `1`. | | `truncation_cutoff` | `float` or `None` | Entanglement cutoff for later layers. Defaults to `1e-6`. | | `fine_tuning_iterations` | `int` | Maximum gradient-based refinement iterations. Defaults to `20`. | ## Supported Direct 2D Distributions | Name | Support | Parameters | | :- | :- | :- | | `bivariate_student_t` | all real `x` and `y` | `mu`, `sigma`, `nu` | | `bivariate_gamma` | positive `x` and `y` | `nu`, `rho` | | `bivariate_von_mises` | angular domain, usually `[-pi, pi) x [-pi, pi)` | `mu1`, `mu2`, `kappa1`, `kappa2`, `lam`, optional `n_norm` | | `marshall_olkin_weibull` | positive `x` and `y` | `lambda1`, `lambda2`, `lambda3`, `k` | | `bivariate_poisson_normal_approx` | continuous approximation on all real `x` and `y` | `lambda1`, `lambda2`, `lambda3` | ### Bivariate Student-t **Name in SDK:** `bivariate_student_t` A heavy-tail generalization of the bivariate Gaussian. It is useful when the joint distribution needs Gaussian-like correlation structure while retaining robustness to tail events and outliers. The density is the standard two-dimensional Student-t PDF with location vector `mu`, scale matrix `sigma`, and degrees of freedom `nu`. $f(x,y) = \frac{\Gamma((\nu+2)/2)}{\Gamma(\nu/2)\nu\pi|\Sigma|^{1/2}}\left(1 + \frac{(z-\mu)^T\Sigma^{-1}(z-\mu)}{\nu}\right)^{-(\nu+2)/2}$ where $z=(x,y)^T$. | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `mu` | array-like shape `(2,)` | finite | Location vector | | `sigma` | array-like shape `(2, 2)` | positive-definite | Scale matrix | | `nu` | `float` | greater than `0` | Degrees of freedom | ```python theme={null} data_loading_gate = haiqu.multivariate_distribution_loading( distribution_name="bivariate_student_t", num_qubits=(4, 4), interval=((-4.0, 4.0), (-4.0, 4.0)), encoding="probability", distribution_params={ "mu": [0.0, 0.0], "sigma": [[1.0, 0.5], [0.5, 1.0]], "nu": 4.0, }, ).result() ``` ### Bivariate Gamma **Name in SDK:** `bivariate_gamma` Kibble's bivariate Gamma distribution with Gamma marginals and a positive dependence parameter. The implementation uses the scaled modified Bessel function for numerical stability. $f(x,y) = \frac{(xy)^{(\nu-1)/2}}{\Gamma(\nu)(1-\rho)\rho^{(\nu-1)/2}}\exp\left(-\frac{x+y}{1-\rho}\right)I_{\nu-1}\left(\frac{2\sqrt{\rho xy}}{1-\rho}\right)$ where $I_{\nu-1}$ is the modified Bessel function of the first kind. For `rho=0`, the implementation returns the product of two independent Gamma densities. | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `nu` | `float` | greater than `0` | Marginal Gamma shape | | `rho` | `float` | in `[0, 1)` | Positive correlation parameter | ```python theme={null} data_loading_gate = haiqu.multivariate_distribution_loading( distribution_name="bivariate_gamma", num_qubits=8, interval=((0.0, 8.0), (0.0, 8.0)), encoding="probability", distribution_params={"nu": 2.0, "rho": 0.4}, ).result() ``` ### Bivariate von Mises **Name in SDK:** `bivariate_von_mises` A circular analogue of the bivariate Gaussian, defined on angular variables. The implementation uses the Sine model and computes the normalizing constant numerically. $f(\theta_1,\theta_2) = \exp\left(\kappa_1\cos(\theta_1-\mu_1) + \kappa_2\cos(\theta_2-\mu_2) + \lambda\sin(\theta_1-\mu_1)\sin(\theta_2-\mu_2)\right)$ | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `mu1` | `float` | radians | Mean direction of the first angle | | `mu2` | `float` | radians | Mean direction of the second angle | | `kappa1` | `float` | at least `0` | Concentration of the first angle | | `kappa2` | `float` | at least `0` | Concentration of the second angle | | `lam` | `float` | real | Coupling parameter | | `n_norm` | `int` | positive | Grid size per dimension for numerical normalization, default `100` | ```python theme={null} data_loading_gate = haiqu.multivariate_distribution_loading( distribution_name="bivariate_von_mises", num_qubits=8, interval=((-3.14159, 3.14159), (-3.14159, 3.14159)), encoding="probability", distribution_params={ "mu1": 0.0, "mu2": 0.4, "kappa1": 2.0, "kappa2": 1.5, "lam": 0.8, }, ).result() ``` ### Marshall-Olkin Bivariate Weibull **Name in SDK:** `marshall_olkin_weibull` A shock model with independent failure sources for each variable and a shared common shock. The implemented density is the absolutely continuous part; the singular mass on the diagonal `x = y` is not represented. For `x < y`, the density is: $f(x,y) = \lambda_1(\lambda_2+\lambda_3)k^2(xy)^{k-1}\exp\left(-\lambda_1x^k-(\lambda_2+\lambda_3)y^k\right)$ For `x > y`, the density is: $f(x,y) = \lambda_2(\lambda_1+\lambda_3)k^2(xy)^{k-1}\exp\left(-(\lambda_1+\lambda_3)x^k-\lambda_2y^k\right)$ On `x = y`, the absolutely continuous density returned by this function is `0`. | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `lambda1` | `float` | greater than `0` | Independent shock rate for `X` | | `lambda2` | `float` | greater than `0` | Independent shock rate for `Y` | | `lambda3` | `float` | at least `0` | Common-shock rate | | `k` | `float` | greater than `0` | Weibull shape | ```python theme={null} data_loading_gate = haiqu.multivariate_distribution_loading( distribution_name="marshall_olkin_weibull", num_qubits=8, interval=((0.0, 4.0), (0.0, 4.0)), encoding="probability", distribution_params={ "lambda1": 1.0, "lambda2": 1.2, "lambda3": 0.4, "k": 1.5, }, ).result() ``` ### Bivariate Poisson Normal Approximation **Name in SDK:** `bivariate_poisson_normal_approx` A continuous Gaussian approximation to a bivariate Poisson model constructed from `X = Z_1 + Z_3` and `Y = Z_2 + Z_3`, where each `Z_i` is Poisson-distributed. The shared component `Z_3` induces covariance. $\mu = [\lambda_1+\lambda_3,\ \lambda_2+\lambda_3]$ $\Sigma_{11} = \lambda_1+\lambda_3,\quad \Sigma_{22} = \lambda_2+\lambda_3,\quad \Sigma_{12} = \Sigma_{21} = \lambda_3$ | Parameter | Type | Constraints | Description | | :- | :- | :- | :- | | `lambda1` | `float` | greater than `0` | Rate of `X`'s independent component | | `lambda2` | `float` | greater than `0` | Rate of `Y`'s independent component | | `lambda3` | `float` | at least `0` | Shared component rate | ```python theme={null} data_loading_gate = haiqu.multivariate_distribution_loading( distribution_name="bivariate_poisson_normal_approx", num_qubits=8, interval=((0.0, 12.0), (0.0, 12.0)), encoding="probability", distribution_params={ "lambda1": 2.0, "lambda2": 3.0, "lambda3": 1.0, }, ).result() ``` ## Copula-Based Joint PDFs Copula loading builds a joint PDF from two `scipy.stats` marginals and a supported [copula](https://en.wikipedia.org/wiki/Copula_\(statistics\)) density using [Sklar's theorem](https://en.wikipedia.org/wiki/Copula_\(statistics\)#Sklar's_theorem). $f(x,y) = c(F_X(x), F_Y(y)) f_X(x) f_Y(y)$ Use a copula name in `distribution_name`, provide the copula parameters in `copula_params`, and provide exactly two marginal names and parameter dictionaries. | Copula name | Parameters | Dependence behavior | | :- | :- | :- | | `gaussian_copula` | `rho` in `(-1, 1)` | Gaussian dependence structure | | `clayton_copula` | `theta` at least `0` | Lower-tail dependence | | `gumbel_copula` | `theta` at least `1` | Upper-tail dependence | | `frank_copula` | non-zero `theta` | Symmetric dependence without tail concentration | The supported copula densities are: $c_{\mathrm{Gaussian}}(u,v) = \frac{1}{\sqrt{1-\rho^2}}\exp\left(\frac{\rho(2xy-\rho(x^2+y^2))}{2(1-\rho^2)}\right),\quad x=\Phi^{-1}(u),\ y=\Phi^{-1}(v)$ $c_{\mathrm{Clayton}}(u,v) = (1+\theta)(uv)^{-(\theta+1)}(u^{-\theta}+v^{-\theta}-1)^{-1/\theta-2}$ $c_{\mathrm{Gumbel}}(u,v) = \exp(-A^{1/\theta})(st)^{\theta-1}A^{1/\theta-2}\frac{A^{1/\theta}+\theta-1}{uv},\quad s=-\ln u,\ t=-\ln v,\ A=s^\theta+t^\theta$ $c_{\mathrm{Frank}}(u,v) = \frac{-\theta(e^{-\theta}-1)e^{-\theta(u+v)}}{\left(e^{-\theta}-1+(e^{-\theta u}-1)(e^{-\theta v}-1)\right)^2}$ ```python theme={null} data_loading_gate = haiqu.multivariate_distribution_loading( distribution_name="gaussian_copula", num_qubits=(4, 4), interval=((-4.0, 4.0), (0.0, 8.0)), encoding="probability", copula_params={"rho": 0.6}, marginal_distribution_names=["norm", "gamma"], marginal_distribution_params=[ {"loc": 0.0, "scale": 1.0}, {"a": 2.0, "scale": 1.0}, ], ).result() ``` > [!NOTE] > > `distribution_params` are only valid for direct 2D distributions. For copulas, use `copula_params`, `marginal_distribution_names`, and `marginal_distribution_params`. ## Normal and Lognormal Distributions Normal and lognormal marginals can be loaded via the copula interface using `scipy.stats` distribution names. Both examples below use a Gaussian copula, which preserves the familiar Gaussian dependence structure. ### Bivariate Normal Use `"norm"` as both marginal names. The `loc` and `scale` parameters correspond to the mean and standard deviation of each margin. ```python theme={null} job = haiqu.multivariate_distribution_loading( distribution_name="gaussian_copula", num_qubits=(4, 4), interval=((-4.0, 4.0), (-4.0, 4.0)), encoding="probability", copula_params={"rho": 0.0}, marginal_distribution_names=["norm", "norm"], marginal_distribution_params=[ {"loc": 0.0, "scale": 1.0}, {"loc": 0.0, "scale": 1.0}, ], ) data_loading_gate = job.result() ``` ### Bivariate Lognormal Use `"lognorm"` as both marginal names. In `scipy.stats`, `lognorm` is parameterized by shape `s` (the standard deviation of the underlying normal in log-space), `loc` (shift, usually `0`), and `scale` (equal to `exp(mu)` where `mu` is the mean of the underlying normal). ```python theme={null} job = haiqu.multivariate_distribution_loading( distribution_name="gaussian_copula", num_qubits=(4, 4), interval=((0.01, 6.0), (0.01, 6.0)), encoding="probability", copula_params={"rho": 0.4}, marginal_distribution_names=["lognorm", "lognorm"], marginal_distribution_params=[ {"s": 0.5, "loc": 0.0, "scale": 1.0}, {"s": 0.8, "loc": 0.0, "scale": 1.0}, ], ) data_loading_gate = job.result() ``` > [!NOTE] > > The lognormal interval must exclude zero. Use a small positive lower bound such as `0.01` rather than `0.0` to avoid evaluating the density at the boundary. # QML building blocks Source: https://docs.haiqu.ai/catalog/qml_building_blocks Gates, ansatze, and variational solvers provided by Haiqu SDK A catalog of the quantum machine learning components shipped with Haiqu SDK. Each entry links to the workflow guide that shows it in context and to the API reference for exact signatures and return types. ## Gates and ansatze | Component | Description | Learn more | | :- | :- | :- | | `su2_equivariant_2_qubit_gate` | The unique 2-qubit SU(2)-equivariant primitive gate: phases the singlet sector and leaves the triplet sector unchanged. | [Guide](/core_features/equivariant_gates) · [Reference](/reference/qml/equivariant) | | `su2_equivariant_3_qubit_gate` | The exact 3-qubit SU(2)-equivariant gate; four angles parameterize the allowed mixing between the two spin-1/2 copies. | [Guide](/core_features/equivariant_gates) · [Reference](/reference/qml/equivariant) | | `su2_equivariant_ansatz` | Parameterized spin-symmetry-preserving ansatz built from the 2-qubit primitive; supports brickwork, linear, and custom pair layouts. | [Guide](/core_features/equivariant_gates) · [Reference](/reference/qml/equivariant) | ## Symmetry and verification helpers | Component | Description | Learn more | | :- | :- | :- | | `is_su2_equivariant` | Check whether a dense unitary commutes with all three global spin generators. | [Guide](/core_features/equivariant_gates) · [Reference](/reference/qml/equivariant) | | `spin_generators` | Dense global spin generators `(S_x, S_y, S_z)` for diagnostics and symmetry-aware observables. | [Guide](/core_features/equivariant_gates) · [Reference](/reference/qml/equivariant) | | `total_spin_ops` | Dense total spin operators `(S^2, S_z)`. | [Guide](/core_features/equivariant_gates) · [Reference](/reference/qml/equivariant) | | `brickwork_pattern` | Nearest-neighbor even-then-odd qubit pair layout used by the brickwork ansatz. | [Guide](/core_features/equivariant_gates) · [Reference](/reference/qml/equivariant) | ## Variational solvers | Solver | Description | Learn more | | :- | :- | :- | | `haiqu.variational_optimization` | Minimize an observable expectation value, or a nonlinear objective over several observables, for a parameterized ansatz using NFT or SciPy optimizers. | [Guide](/core_features/qml) · [Reference](/reference/qml/variational) | | `haiqu.pretrain` | Pretrain ansatz parameters against the problem objective to warm-start a variational optimization. | [Reference](/reference/qml/pretrain) | | `haiqu.su2_equivariant_compilation` | Fit a shallow brickwork circuit of 2-qubit SU(2)-equivariant gates to an equivariant target unitary. | [Guide](/core_features/equivariant_gates#compile-an-equivariant-target) · [Reference](/reference/qml/equivariant) | # Circuit Analytics Source: https://docs.haiqu.ai/core_features/circ_analytics Depth, gate counts, and advanced metrics for any circuit with the Haiqu SDK — including compressed and data-loaded circuits that local Qiskit tooling cannot measure Quantum circuit analysis is important for understanding the structure, complexity, and feasibility of executing a circuit on quantum hardware or simulators. It helps to identify key properties such as gate composition, depth, connectivity, and noise susceptibility, which impact performance and accuracy. > [!NOTE] > > Analytics are computed cloud-side, which makes them the **only** way to measure circuits > containing opaque Haiqu-generated gates — data-loading results and > [compression](/core_features/compression) `CircuitModel` outputs — where local `circuit.depth()` > and gate counts are misleading. See > [Working with Haiqu Circuits](/core_features/haiqu_circuits). Haiqu SDK provides a number of analytics functions, properties and widgets: | Property or Function | Description | | :- | :- | | `haiqu_circuit.analytics` | Provides ALL raw metrics data, represented as Python objects. | | `haiqu_circuit.core_metrics()` | Renders a widget that displays a table of core analytics metrics. | | `haiqu_circuit.compare_metrics()` | Renders a widget with a comparison table of core analytics for provided circuits. | Each analytics widget includes built-in help for the displayed metrics, turned on with `help=True` option. Whenever possible, the widget displays a column to provide assistance for each metric. Data can be exported in formats including JSON, CSV, or used in Pandas for further analysis. Let's start by defining an example quantum circuit, then display it: ```python theme={null} from qiskit.circuit.random import random_circuit # Generate a random quantum circuit with the following parameters: circuit = random_circuit( num_qubits=16, # Total number of qubits in the circuit (16-qubit system) depth=4, # The number of gate layers applied max_operands=4, # Maximum number of qubits any multi-qubit gate can act on seed=42, # Random seed for reproducibility (ensures same circuit structure on each run) measure=False # Do not include measurement operations at the end of the circuit ) # Assign a name to the circuit for easy identification circuit.name = "Haiqu 16-qubit hello world" # Display the generated circuit haiqu.draw(circuit) ``` ![Light mode interface](https://mintcdn.com/haiqu/QnjSg02a6HjnZweN/images/haiqu_draw_light.png?fit=max\&auto=format\&n=QnjSg02a6HjnZweN\&q=85\&s=4f4294596456ffca01c45a04a56ae38c) To utilize the analytics functions invoke the `haiqu.log()` method. This computes the complete set of quantum metrics using the Haiqu API and returns them in a single metadata object. Let's submit our `circuit` to the Haiqu quantum backend for analysis: ```python theme={null} haiqu_circuit = haiqu.log(circuit) ``` ## Basic analysis Before executing a quantum circuit, it is crucial to assess its fundamental properties to ensure feasibility and compatibility with available simulators or hardware. This step helps determine circuit size, gate composition, and whether it contains custom or unsupported operations. By analyzing these factors, users can make informed decisions about device selection, potential optimizations, and whether additional modifications are needed before execution. The circuit's basic metrics are displayed using `core_metrics`: ```python theme={null} haiqu_circuit.core_metrics(help=True) ``` ![Light mode interface](https://mintcdn.com/haiqu/QnjSg02a6HjnZweN/images/core_metrics_light.png?fit=max\&auto=format\&n=QnjSg02a6HjnZweN\&q=85\&s=eaaf3871f1813213c119e8695fc11e12) To use this function in a terminal or a script and get metrics as a dictionary, use it with the `widget=False` parameter: ```python theme={null} haiqu_circuit.core_metrics(widget=False) >>> {'qubits': 8, 'num_parameters': 0, 'depth': 5, 'depth_2q': 4, 'gates_1q': 1, 'gates_2q': 7, 'other_gates': 8, 'gates_total': 16, 'other_ops': 8, 'instructions_total': 24} ``` ## Accessing metrics directly Let's submit the example quantum circuit for analysis: ```python theme={null} from qiskit.circuit.random import random_circuit qc = random_circuit(num_qubits=8, depth=5, max_operands=4, measure=True) haiqu_circuit = haiqu.log(qc, name="Example Circuit") ``` Now the metrics could be accessed as regular Python objects. To access the number of qubits, use: ```python theme={null} haiqu_circuit.analytics.qubits >>> 8 ``` To access the depth of circuit, use: ```python theme={null} haiqu_circuit.analytics.depth >>> 5 ``` And so on. ## Display a breakdown of the different gate types present in the circuit To access the number of operations with the details for each of the gate type, use: ```python theme={null} haiqu_circuit.analytics.operations_counts >>> {'measure': 8, 'cswap': 4, 'rccx': 2, 'sdg': 2, 'z': 2, 's': 1, 'dcx': 1, 'u3': 1, 'cu': 1, 'rxx': 1, 'x': 1, 'rzz': 1, 'cp': 1, 'p': 1, 'xx_plus_yy': 1, 'sx': 1} ``` ## Comparing circuits The function `haiqu.compare_metrics` shows a table with the core metrics of several circuits. This can be useful to understand the difference between the circuits or how a circuit changes with respect to a parameter. ```python theme={null} haiqu.compare_metrics(circuit1, circuit2, ...) ``` For instance, the following example compares two circuits obtained as a transpilation of the same initial circuit but with different options: ```python theme={null} transpiled_circuit_opt0 = haiqu.transpile(circuit, device, optimization_level=0) transpiled_circuit_opt3 = haiqu.transpile(circuit, device, optimization_level=3) haiqu.compare_metrics(transpiled_circuit_opt0, transpiled_circuit_opt3) ``` ![Light mode interface](https://mintcdn.com/haiqu/QnjSg02a6HjnZweN/images/compare_metrics_image_light.png?fit=max\&auto=format\&n=QnjSg02a6HjnZweN\&q=85\&s=364066263f73bfab94938b307c3f8b74) # Compression Source: https://docs.haiqu.ai/core_features/compression Reduce circuit depth up to 100x with state_compression: usage, quality metric, parameters, and how to measure the compressed result Haiqu SDK `state_compression` function is an approximate compilation method extending the depth of the circuit, which can be run on noisy hardware. It automatically adjusts the compression parameters to achieve the best performance by taking into account the device's characteristics, including noise and topology. ## Linear topology compression To compress a circuit using idealized linear topology you simply create a state compression job ```python theme={null} job = haiqu.state_compression(circuit=circuit) ``` and obtain the compressed circuit as a result ```python theme={null} circuit_compressed = job.result() quality = job.quality ``` The computed `quality` metric is a fidelity-like metric, which Haiqu internally computes in the end of the compression to quantify circuit approximation quality on a noiseless device. Unlike quantum state fidelity it is scalable and does not vanish with increasing the systems size, meanwhile it is highly correlated with the observables precision. As a rule of thumb you can treat its values as follows: | Quality | Description | | - | - | | 100% | Perfect match between quantum states, generated by the original and compressed circuits | | 90% | Very good quality | | 75% | Good quality | | 50% | Mediocre quality | | 0% | States do not match at all | > [!NOTE] > > Haiqu’s compression utilizes the device’s noise profile to ensure the best results on actual hardware. Default noise settings correspond to IBM's Heron R2 device and can be changed by modifying `noise_profile` parameter (see below). State compression function can trade-off theoretical approximation on an ideal device for more compact circuits that perform better on real quantum hardware. In the following frame you can see the metrics comparison of the original and compressed 50-qubits randomly generated circuit with `qiskit.circuit.random.random_circuit`. ![Image](https://mintcdn.com/haiqu/DjRJlqQlLMCYZfXw/images/compression_comparison_example.png?fit=max\&auto=format\&n=DjRJlqQlLMCYZfXw\&q=85\&s=c4f761fba419cbdad5bc8c635cee6263) ## Device topology-aware compression To use device topology-aware compression, use the `state_compression_2d` method. For example: ```python theme={null} job = haiqu.state_compression_2d(circuit=circuit, device_id="ibm_fez") circuit_compressed = job.result() ``` This call requires specifying the device, and results in an already compressed and transpiled circuit. The method uses noise data from the device to tune the compression approximation rates automatically. > [!NOTE] > > `state_compression_2d` is currently limited only to devices with heavy-hex connectivity. > [!TIP] > > The basic `state_compression` function is computationally very efficient and should be used by default for general circuits. `state_compression_2d` is computationally more demanding and achieves very good results when the input circuits have already been designed with a particular device topology in mind. ## Measuring the compressed circuit `job.result()` returns a `CircuitModel`, not a plain `QuantumCircuit` or `HaiquCircuitGate`. Local `circuit.depth()` and gate counts are misleading on opaque gates; transpile with Haiqu and read [circuit analytics](/core_features/circ_analytics) on the returned `CircuitModel`: ```python theme={null} device = haiqu.get_device("fake_torino") transpiled = haiqu.transpile(circuit_compressed, device) depth = transpiled.analytics.depth depth_2q = transpiled.analytics.depth_2q gates_2q = transpiled.analytics.gates_2q ``` See [Working with Haiqu Circuits](/core_features/haiqu_circuits) for the full list of what works locally on compressed circuits and what requires the cloud. ## Parameters * `circuit` – the quantum circuit whose action on all-0 state is to be compressed. * `compression_level` – defines the compression level. Increased compression level will lead to larger part of the input circuit being compressed. Three options are available: * `low` – this setting is best used for already shallow input circuits or very low noise levels; * `balanced` – the default setting gives the best performance for most circuits and noise profiles; * `high` – this setting may sometimes yield better results for very deep circuits. * `noise_profile` – sets the noise profile to which the function adjusts the compression algorithm. Used to automatically set the approximation level. Currently available options are `"ibm_eagle_r3"`, `"ibm_heron_r1"`, `"ibm_heron_r2"` (used by default), `"ibm_heron_r3"`, `"iqm_garnet"` and `"iqm_emerald"`. * `fine_tuning` – uses classical resources to further improve the compressed circuit. Three options are available: * `disabled` – no fine-tuning performed, the lowest latency; * `low` – default, best balance between speed and accuracy; * `heavy` – improved circuit accuracy, but time-intensive. * `approximation_level` – an integer-valued parameter influencing circuit complexity. Larger values improve the noiseless quality metric, but may degrade noisy performance. Defaults to None, which corresponds to auto-selection using the provided noise profile. Can be set to any value from **1** (very weak approximation) to **8** (very high approximation). Larger approximation level values lead to slower fine-tuning. * `device` or `device_id` (only for `state_compression_2d`) – target device for the compression. See [Haiqu SDK Reference | State Compression](/reference/middleware/compression) for more details on`haiqu.state_compression` and `haiqu.state_compression_2d`. ## State Compression Specifications | **Parameter** | **Details** | | :- | :- | | **Number of qubits** | Up to 1000 | | **Runtime (at 100 qubits)** | From few seconds and up to 2 minutes with no fine-tuning; up to 15 minutes with heavy fine-tuning | | **Runtime scaling** | Linear scaling with circuit size, problem-dependent | | **Supported circuits** | - Circuits decomposable into CNOT, RX, RY, RZ basis gates - Circuits with mid-circuit measurements are supported, but compression applies only prior to MCM | | **Supported connectivity** | Any. Not transpiled input with Linear connectivity is preferred. | | **Compression rate** | Up to 100× for various application circuits | | **Returned metrics** | - Compression rate - Quality of the compression (fidelity-like metric) | ## State Compression 2D Specifications | **Parameter** | **Details** | | :- | :- | | **Number of qubits** | Up to the available number of qubits on the quantum device | | **Runtime (at 100 qubits)** | From 1 to 5 minutes with no fine-tuning; up to 30 minutes with heavy fine-tuning | | **Runtime scaling** | Polynomial scaling with circuit size, problem- and device-dependent | | **Supported circuits** | - Circuits decomposable into CNOT, RX, RY, RZ basis gates - Circuits with mid-circuit measurements are supported, but compression applies only prior to MCM | | **Supported connectivity** | Any. Circuit will be transpiled to the device connectivity but preferable to already follow it. | | **Compression rate** | Up to 100× for various application circuits | | **Returned metrics** | - Compression rate - Quality of the compression (fidelity-like metric) | \*runtime can vary for different circuit classes of the same size # Distribution Loading Source: https://docs.haiqu.ai/core_features/data_loading_dist Load scipy.stats distributions into compact circuits at record scales; returns an opaque Haiqu gate to embed in your circuits A key challenge in quantum computing applications — such as quantum machine learning, finance, and optimization — is efficiently encoding classical data into quantum states. In this tutorial, we'll load a classical probability distribution (like the normal distribution) into a quantum state, which is a core primitive for various financial and simulation applications. > [!TIP] > > * **Goal**: Encode a probability distribution into a quantum state such that measurement outcomes follow the target distribution. > * **Use Case**: Financial modeling, probabilistic simulations, quantum generative models. > * **How it works**: The square root of the distribution (e.g., Gaussian) is encoded in quantum amplitudes via state preparation circuits. Haiqu SDK offers a simple function to load over 100 distributions supported by [scipy.stats](https://docs.scipy.org/doc/scipy/reference/stats.html#continuous-distributions) library. For example, loading a Normal distribution into the quantum state can be done by running the following function that initializes a data loading job: ```python theme={null} job = haiqu.distribution_loading( name=f"DL norm {num_qubits}q", # Name num_qubits=num_qubits, # Number of qubits distribution_name="norm", # Distribution to load interval_start=-3, interval_end=3, # Interval over which to load num_layers=2 # Precision parameter ) ``` The corresponding state preparation gate is returned by calling `job.result()`the job result: ```python theme={null} data_loading_gate = job.result() # a HaiquCircuitGate, encapsulating state preparation circuit fidelity = job.quality # fidelity of the state preparation circuit ``` Above `fidelity` quantifies the overlap between a wavefunction generated by the synthesized circuit and the exact discretized input distribution, computed as [quantum state fidelity](https://en.wikipedia.org/wiki/Fidelity_of_quantum_states). The quality of the obtained data loading circuit can be visually verified using e.g. statevector simulation. For the Normal distribution example using `num_qubits=8` we obtain the following result: ```python theme={null} qc = QuantumCircuit(num_qubits) # add the data loading gate to the circuit qc.compose(data_loading_gate, inplace=True) # run exact simulation sv = haiqu.statevector_run(qc).result()[0] # plot probabilities plt.plot(np.square(np.abs(sv))) ``` ![Image](https://mintcdn.com/haiqu/DjRJlqQlLMCYZfXw/images/1d_normal_example.png?fit=max\&auto=format\&n=DjRJlqQlLMCYZfXw\&q=85\&s=f9ef31259a345a25123e20b2bfe33937) The required parameters of the `distribution_loading` method are: * `distribution_name:` name of the statistical distribution from `scipy.stats`. * `interval_start` and `interval_end`: the boundaries of the interval over which the distribution will be discretized before loading into the quantum state. * `num_qubits` : the number of qubits used, which sets the discretization resolution. Additionally, the user can control advanced parameters, such as: **Distribution Hyperparameters (Optional, follows SciPy's API)** * `loc` (default: 00) → The location/mean of the distribution. * `scale` (default: 11) → Scale or spread, often linked to variance. * `shape` parameters → Distribution-specific extra parameters. Check SciPy docs for details. **State Preparation Hyperparameters (Optional)** * `num_layers` (default: 11) → Number layer in the data loading circuit. More layers = better approximation of data or distribution, but more gates. * `truncation_cutoff` (default: `1e-6`) → A threshold for cutting off low-entanglement gates. Set to `None` or `0` for no truncation (full entanglement retained). ## Distribution Loading Specifications | **Parameter** | **Details** | | :- | :- | | **Number of qubits** | Up to 1000 qubits | | **Number of distributions** | 107 different classes of distributions are supported. Check SciPy docs for details. | | **Runtime** | 1–15 seconds | | **Runtime scaling** | Linear scaling with number of qubits | | **Circuit size (gates count)** | O(n), n = number of qubits | | **Circuit depth** | O(n/2), n = number of qubits | | **Circuit connectivity** | Linear | | **Other circuit properties** | - No mid-circuit measurements - Only CNOT and single-qubit rotation gates - No ancillary qubits - No post-selection required in state preparation | | **Returned metrics** | Quantum state fidelity is returned for the ideal state prepared by the circuit | # Feature embedding Source: https://docs.haiqu.ai/core_features/data_loading_isom Encodes classical (machine learning) features with compact quantum circuits A key challenge in quantum machine learning (QML) applications is efficiently encoding classical data into quantum states. The trivial amplitude encoding, while requiring only a logarithmic number of qubits, results in deep circuits and low fidelity on quantum devices. The angular encoding, on the other hand, only allows encoding linearly many features (in the number of qubits), which is insufficient for most real-life datasets. Haiqu SDK contains feature loading methods, which address both of these limitations: `Entanglied Manifold Embedding` and `Block Vector Loading`. > [!TIP] > > For unstructured features, such as features from a tabular dataset or obtained from feature extraction methods like Principal Component Analysis, it is recommended to use `Entangled Manifold Embedding`. > > If your machine learning samples contain spatial dependency, for example, a wave signal or an image, it is recommended to load each sample with `Block Vector Loading`. ## Entangled Manifold Embedding Haiqu SDK introduces a novel feature loading method `Entangled Manifold Embedding`. It embeds a classical feature vector in a sub-manifold of the full Hilbert space, consisting of states of a controllable entanglement. Each classical feature corresponds to a degree of freedom in this sub-manifold, independently and non-linearly affecting the resulting quantum state, which is synthesized into compact, linear-in-depth circuits. The complexity of the encoding, or equivalently the entanglement is controlled by the feature `density` parameter $D$. The number of features, which is possible to encode using $n$ qubits is approximately equal to $nD^2$. To encode a fixed number of features the user can set either the density $D$ or the desired number of qubits $n$ (the minimal possible density is then chosen automatically). When $D=1$ the Entangled Manifold Embedding is equivalent to the angular encoding. To encode a real feature vector simply call `haiqu.entangled_manifold_embedding(...)`. ```text theme={null} job = haiqu.entangled_manifold_embedding( name="EME Circuit", # Name data=feature_vector # Feature vector. ) gate = job.result() # a HaiquCircuitGate, encapsulating the embedding circuit ``` Feature vector must be a real one-dimensional vector. The method can produce states either using real- or complex-valued amplitudes. > [!TIP] > > While `Entangled Manifold Embedding` can encode feature with arbitrary values and ranges, and unnormalized, in most applications it is useful to standardize the features (e.g. by re-scaling each feature mean and variance to 0 and 1, respectively). The table below shows the number of features that can *potentially* be loaded on different hardware platforms as a function of the feature density parameter $D$. > [!NOTE] > > The estimations are approximate and take into account the number of qubits available on the devices, and device's Quantum Volume. The latter defines the largest random circuit of equal width and depth, which can be successfully run on a device with certain precision, and effectively quantifies the sensitivity of the device to noise. Large noise can effectively blur the distinction between different feature vectors. | **Hardware** | D=2 | **D=4** | **D=8** | | :- | :- | :- | :- | | IBM Heron | 544 | 1,622 | 4,342 | | IQM Emerald | 191 | 570 | 1,209 | | IonQ Forte 1 | 129 | 380 | 779 | | Rigetti Ankaa-3 | 303 | 891 | 834 | | OQC Toshiko | 118 | 336 | 318 | ## Block Vector Loading Encoding a dataset of size $N$ with amplitude encoding requires $\log N$ qubits and may generate exponentially deep circuits to achieve high fidelity.`Block Vector Loading` encodes the data by splitting it into smaller blocks and loading them independently. It results in shallower quantum circuits at the cost of using more qubits. This approach introduces a practical trade-off between qubit count and fidelity. > [!TIP] > > More blocks → more qubits → shallower circuits → higher fidelity on a noisy device. `Block Vector Loading` enables data preparation for utility scale QML, particularly when the spatial dependencies within the data need to be preserved (e.g. for images). To block-encode classical data vectors into a quantum state call`haiqu.block_vector_loading(...)`. For example, ```text theme={null} random_vector_1d = numpy.random.random(200) job = haiqu.block_vector_loading( name="Example with target_num_qubits", data=random_vector_1d, # example 1D vector target_num_qubits=100, # specify target number of qubits num_layers=1 ) gate = job.result() # a HaiquCircuitGate, encapsulating state preparation circuit fidelity = job.quality # fidelity of the state preparation circuit ``` will load a random vector of size 200 into a shallow single-layer `HaiquCircuitGate` with fidelity close to 1. ## Entangled Manifold Embedding specifications | **Parameter** | **Details** | | :- | :- | | **Number of qubits** | Up to 1000 qubits | | **Input data** | 1D vector | | **Data type** | Real values | | **Data size** | Up to \~1M features in the vector | | **Density** | From 1 to 8 | | **Runtime** | 1-10 seconds with no fine-tuning; up to 2 minutes with fine-tuning | | **Runtime scaling** | Linear scaling with number of qubits | | **Circuit size (gates count)** | O(n), n = number of qubits | | **Circuit depth** | O(n/2), n = number of qubits | | **Circuit connectivity** | Linear | | **Other circuit properties** | - No mid-circuit measurements - Only CNOT and single-qubit rotation gates - No ancilla qubits - No post-selection required in state preparation | | **Returned metrics** | Quantum state fidelity is returned for the ideal state prepared by the circuit | ## Block Vector Loading specifications | **Parameter** | **Details** | | :- | :- | | **Number of qubits** | 1000+ qubits; no more than 20 qubits for a single block | | **Input data** | 1D vector 2D matrix | | **Data type** | Real and complex values | | **Data size** | Any, with no more than \~1M features for a single block | | **Runtime** | 0.5–2 minutes per block | | **Runtime scaling** | Linear scaling with number of qubits | | **Circuit size (gates count)** | O(n), n = number of qubits | | **Circuit depth** | O(m/2), m = number of qubits in each block | | **Circuit connectivity** | Linear within each block, arbitrary between blocks | | **Other circuit properties** | - No mid-circuit measurements - Only CNOT and single-qubit rotation gates - No ancilla qubits - No post-selection required in state preparation | | **Returned metrics** | Quantum state fidelity is returned for the ideal state prepared by the circuit | # Data Loading Source: https://docs.haiqu.ai/core_features/data_loading_vect Load custom vectors into compact quantum circuits; returns an opaque Haiqu gate to embed in your circuits A key challenge in quantum computing applications — such as quantum machine learning, finance, and optimization — is efficiently encoding classical data into quantum states. While loading data into the amplitudes of a quantum state allows one to load $2^{NumQubits}$ values, the standard circuits to prepare such states may require an exponentially large number of operations in number of qubits, making it impractical. > [!NOTE] > > Haiqu's data loading methods allow encoding of an arbitrary data into the amplitudes of the quantum state. They are particularly useful for applications in quantum simulation, machine learning, quantum optimization, solving differential equations and others. ## Loading an arbitrary 1D data vector Here we introduce one of the loading procedures available in Haiqu SDK: `Vector Loading` allows to load a vector (1D array) of classical data directly into the amplitudes of a quantum state, producing compact, linear-in-depth circuits. > [!NOTE] > > The input vector is a real- or complex-valued one-dimensional vector, which contains the values to be encoded in the amplitudes. `Vector Loading` automatically adjusts to the closest minimal necessary number of qubits and normalizes the data. The current supported maximum size of the vector is $2^{20} =1,048,576$. Haiqu SDK allows you to prepare custom quantum states from classical data vectors by calling `haiqu.vector_loading(...)`. ```python theme={null} job = haiqu.vector_loading( name="Data Loading Circuit", # Name data=data_vector # 1D list with values ) gate = job.result() # a HaiquCircuitGate, encapsulating state preparation circuit fidelity = job.quality # fidelity of the state preparation circuit ``` `vector_loading` , like all other Haiqu's data loading routines, returns a `HaiquCircuitGate` object, which is an abstract Qiskit circuit instruction and can be substituted into user's circuits at any place just like other standard gates. `HaiquCircuitGate` will be unpacked into elementary gates, performing state preparation, at transpilation time internally. All data loading jobs report a [global quantum state fidelity](https://en.wikipedia.org/wiki/Fidelity_of_quantum_states) of the synthesized circuit, that is, an overlap with a quantum state, defined by the input data, and a state, produced by a generated quantum circuit, is computed. It allows to access the quality of the result and possibly tune the synthesis parameters. ## Loading an arbitrary state at utility scale Amplitude encoding has a scaling limitation: it is not possible to explicitly store in a classical memory a state vector for arbitrary large systems, therefore it is not possible to apply `Vector Loading` to them. To alleviate this problem we use the [Matrix Produce State](https://en.wikipedia.org/wiki/Matrix_product_state) (MPS) representation of a wave-function. It is written as a sequence of matrices (tensors) which, when contracted, restore the original state vector. Setting a limit on sizes of such matrices allows to store a "compressed" version of a quantum state at large scales, inaccessible by other means. MPS is a popular method for large scale simulations, however can successfully (without large errors) represent only states with low entanglement. Haiqu SDK contains the `MPS Loading` method, which can generate state preparation circuits at utility scale. The method takes a MPS as an input and supports two MPS formats: the standard MPS (written as sequence of site tensors) and the [Vidal form](https://arxiv.org/abs/quant-ph/0301063) (where in addition a sequence of bond tensors appears). Using `MPS Loading` is very simple: ```python theme={null} job = haiqu.mps_loading( name="Data Loading Circuit", # Name mps=mps # input Matrix Product State ) ``` The method is particularly useful when the user wants to prepare large scale custom state on a quantum computer, for example, when switching from a classical tensor network simulation to a quantum simulation of some evolution. ## Loading multidimensional data In many applications, the input data is naturally represented as a multidimensional array. In the following example we show how to load a custom 2D distribution. First, we prepare a 2D array with multivariate normal distribution on a rectangular $16\times 16$ grid: ```python theme={null} import numpy as np from scipy.stats import multivariate_normal # preparing a grid x = np.linspace(-3, 3, 16) y = np.linspace(-3, 3, 16) grid = np.stack(np.meshgrid(x, y), axis=-1) # 2D grid 16x16 # 2D Normal distribution on the grid data = multivariate_normal([0, 0], [[1, 0.3], [0.3, 1]]).pdf(grid) # in applications square roots of probability distributions are often used data = np.sqrt(data) ``` Since `haiqu.vector_loading(...)` expects a one-dimensional input vector, the data array should first be flattened: ```python theme={null} data = data.ravel() # convert to 1D array ``` The data can now be loaded with `haiqu.vector_loading(...)`: ```python theme={null} job = haiqu.vector_loading(data, name="Multidimensional distribution") gate = job.result() # a HaiquCircuitGate, encapsulating state preparation circuit ``` > [!TIP] > > Using `numpy.ravel()` will naturally order the values in such a way that Vector Loading will use blocks of consecutive qubits for each data dimension (see example below). Such representation often expected in quantum applications. In this example, 8 qubit state will be created, where first 4 qubits will correspond to the Y axis, and the last 4 qubits will correspond to the X axis. The correctness of the encoding can be verified on e.g. a statevector simulator. In our example we recover the original 2D Normal distribution, which we plot below: ```python theme={null} # creating a state preparation circuit # using the constructed HaiquCircuitGate qc = QuantumCircuit(8) qc.compose(gate, inplace=True) # running exact statevector simulator to access amplitudes sv = haiqu.statevector_run(qc).result()[0] # plotting the loaded 2D distribution plt.imshow(np.real(np.resize(sv, (16, 16))), origin="lower") ``` ![Image](https://mintcdn.com/haiqu/DjRJlqQlLMCYZfXw/images/2d_normal_example.png?fit=max\&auto=format\&n=DjRJlqQlLMCYZfXw\&q=85\&s=f57f81e29a5da2471d2ba0593e758f6c) ## Vector Loading specifications | **Parameter** | **Details** | | :- | :- | | **Number of qubits** | Up to 20 qubits | | **Input data** | 1D vector | | **Data type** | Real and complex values | | **Data size** | Up to \~1M features in the vector | | **Runtime** | 0.5–2 minutes | | **Runtime scaling** | Linear scaling with number of qubits | | **Circuit size (gates count)** | O(n), n = number of qubits | | **Circuit depth** | O(n/2), n = number of qubits | | **Circuit connectivity** | Linear | | **Other circuit properties** | - No mid-circuit measurements - Only CNOT and single-qubit rotation gates - No ancilla qubits - No post-selection required in state preparation | | **Returned metrics** | Quantum state fidelity is returned for the ideal state prepared by the circuit | ## Matrix Product State Loading specifications | **Parameter** | **Details** | | | :- | :- | - | | **Number of qubits** | Up to 1000 qubits | | | **Input data** | MPS in standard or Vidal form | | | **Data type** | Tensors with real and complex values | | | **Bond dimension** | Up to 64 | | | **Runtime** | 0.5–2 minutes | | | **Runtime scaling** | Linear scaling with number of qubits | | | **Circuit size (gates count)** | O(n), n = number of qubits | | | **Circuit depth** | O(n/2), n = number of qubits | | | **Circuit connectivity** | Linear | | | **Other circuit properties** | - No mid-circuit measurements - Only CNOT and single-qubit rotation gates - No ancilla qubits - No post-selection required in state preparation | | | **Returned metrics** | Quantum state fidelity is returned for the ideal state prepared by the circuit | | # SU(2)-equivariant gates Source: https://docs.haiqu.ai/core_features/equivariant_gates Build spin-symmetry-preserving gates and ansatze with Haiqu SDK SU(2)-equivariant circuits preserve global spin symmetry. A unitary is SU(2)-equivariant when it commutes with the three global spin generators `S_x`, `S_y`, and `S_z`. Use these primitives when your variational model should stay inside a spin-symmetry-respecting subspace, such as Heisenberg-style spin systems. This page is a workflow guide: it shows how the building blocks fit together, with runnable examples. For exact signatures, parameter defaults, and return types, see the [SU(2)-equivariant gates API reference](/reference/qml/equivariant). ## Overview ```python theme={null} from haiqu.sdk.qml import ( brickwork_pattern, is_su2_equivariant, spin_generators, su2_equivariant_2_qubit_gate, su2_equivariant_3_qubit_gate, su2_equivariant_ansatz, total_spin_ops, ) ``` The utilities covered in this guide are: | Function | Purpose | | :- | :- | | `su2_equivariant_2_qubit_gate(theta)` | Return the 2-qubit SU(2)-equivariant primitive gate. | | `su2_equivariant_3_qubit_gate(theta0, theta1, theta2, theta3)` | Return the exact 3-qubit SU(2)-equivariant gate. | | `su2_equivariant_ansatz(num_qubits, layout="brickwork", num_layers=1, name="theta")` | Build a parameterized equivariant ansatz from 2-qubit primitives. | | `brickwork_pattern(num_qubits, num_layers)` | Return nearest-neighbor even-then-odd pair layout. | | `is_su2_equivariant(U, tol=1e-8)` | Check whether a dense unitary commutes with all three global spin generators. | | `spin_generators(num_qubits)` | Return dense `(S_x, S_y, S_z)`. | | `total_spin_ops(num_qubits)` | Return `(S^2, S_z)`. | ## Two-qubit equivariant gate `su2_equivariant_2_qubit_gate(theta)` returns a 2-qubit `QuantumCircuit`. It phases the singlet sector and leaves the triplet sector unchanged, making it the basic building block for SU(2)-equivariant ansatze. ```python theme={null} from qiskit import QuantumCircuit from qiskit.quantum_info import Operator from haiqu.sdk.qml import is_su2_equivariant, su2_equivariant_2_qubit_gate su2_2q = su2_equivariant_2_qubit_gate(theta=0.7) qc = QuantumCircuit(2) qc.compose(su2_2q, qubits=[0, 1], inplace=True) ok, violation = is_su2_equivariant(Operator(qc).data) print(f"SU(2)-equivariant: {ok}") print(f"max commutator violation: {violation:.2e}") ``` ## Three-qubit equivariant gate `su2_equivariant_3_qubit_gate(theta0, theta1, theta2, theta3)` returns a 3-qubit `QuantumCircuit`. The four angles parameterize the allowed mixing between the two spin-1/2 copies while preserving the spin-3/2 sector. ```python theme={null} from qiskit.quantum_info import Operator from haiqu.sdk.qml import is_su2_equivariant, su2_equivariant_3_qubit_gate su2_3q = su2_equivariant_3_qubit_gate( theta0=0.8, theta1=1.2, theta2=0.5, theta3=2.1, ) ok, violation = is_su2_equivariant(Operator(su2_3q).data) print(f"3-qubit gate equivariant: {ok}") print(f"max commutator violation: {violation:.2e}") ``` ## Build an equivariant ansatz `su2_equivariant_ansatz(...)` wires the 2-qubit gate into a parameterized circuit. Supported layouts are: * `"brickwork"`: nearest-neighbor even bonds, then odd bonds, repeated. * `"linear"`: adjacent chain pairs, repeated. * A custom list of qubit pairs, such as `[[0, 1], [1, 2], [0, 2]]`. ```python theme={null} from haiqu.sdk.qml import brickwork_pattern, su2_equivariant_ansatz print(brickwork_pattern(num_qubits=4, num_layers=1)) ansatz = su2_equivariant_ansatz( num_qubits=4, layout="brickwork", num_layers=2, name="theta", ) print("number of parameters:", len(ansatz.parameters)) print(ansatz.draw()) ``` Use a custom layout when your problem graph is not a simple chain: ```python theme={null} from haiqu.sdk.qml import su2_equivariant_ansatz triangle = su2_equivariant_ansatz( num_qubits=3, layout=[[0, 1], [1, 2], [0, 2]], num_layers=2, ) print("triangle ansatz parameters:", len(triangle.parameters)) ``` ## Verify structural equivariance The ansatz remains equivariant for any parameter values because every block is equivariant. ```python theme={null} import numpy as np from qiskit.quantum_info import Operator from haiqu.sdk.qml import is_su2_equivariant, su2_equivariant_ansatz rng = np.random.default_rng(7) ansatz = su2_equivariant_ansatz(num_qubits=4, num_layers=2) binding = {param: rng.uniform(0, 2 * np.pi) for param in ansatz.parameters} bound_ansatz = ansatz.assign_parameters(binding) ok, violation = is_su2_equivariant(Operator(bound_ansatz).data) print(f"randomly bound ansatz equivariant: {ok}") print(f"max commutator violation: {violation:.2e}") ``` By contrast, a generic hardware-efficient ansatz usually breaks global spin symmetry because single-qubit rotations do not commute with all global spin generators. ```python theme={null} import numpy as np from qiskit.circuit.library import efficient_su2 from qiskit.quantum_info import Operator from haiqu.sdk.qml import is_su2_equivariant rng = np.random.default_rng(7) hardware_efficient = efficient_su2(num_qubits=4, reps=1).decompose() binding = {param: rng.uniform(0, 2 * np.pi) for param in hardware_efficient.parameters} ok, violation = is_su2_equivariant(Operator(hardware_efficient.assign_parameters(binding)).data) print(f"generic EfficientSU2 equivariant: {ok}") print(f"max commutator violation: {violation:.2e}") ``` ## Spin operators `spin_generators(n)` returns dense `(S_x, S_y, S_z)`. `total_spin_ops(n)` returns `(S^2, S_z)`. These are useful for diagnostics and for building symmetry-aware observables. ```python theme={null} import numpy as np from haiqu.sdk.qml import spin_generators, total_spin_ops Sx, Sy, Sz = spin_generators(3) S2, _ = total_spin_ops(3) print("Sx shape:", Sx.shape) print("distinct S^2 eigenvalues:", np.round(np.unique(np.linalg.eigvalsh(S2)), 3)) ``` ## Compile an equivariant target Use `haiqu.su2_equivariant_compilation(...)` to fit a shallow brickwork circuit of 2-qubit SU(2) gates to an equivariant target. > [!NOTE] > > This is a Haiqu cloud job. It requires a logged-in SDK session and an API key. The target can be a `QuantumCircuit`, `Gate`, or dense `numpy.ndarray`. The fit builds a dense unitary, so targets are capped at 10 qubits. ```python theme={null} from haiqu.sdk import haiqu from haiqu.sdk.qml import su2_equivariant_3_qubit_gate haiqu.login() target = su2_equivariant_3_qubit_gate(0.8, 1.2, 0.5, 2.1) job = haiqu.su2_equivariant_compilation( target, target_fidelity=0.99, max_layers=6, num_restarts=10, seed=0, ) compressed = job.result() print("achieved process fidelity:", job.fidelity) haiqu.draw(compressed) ``` You can compare the original and compiled circuits after transpilation: ```python theme={null} device = haiqu.get_device("fake_marrakesh") original_t = haiqu.transpile(target, device=device) compiled_t = haiqu.transpile(compressed, device=device) print("original 2-qubit gates:", original_t.analytics.gates_2q) print("compiled 2-qubit gates:", compiled_t.analytics.gates_2q) haiqu.compare_metrics(original_t, compiled_t) ``` # Error Mitigation Source: https://docs.haiqu.ai/core_features/error_shield Mitigating the effects of the noise in your workloads ## 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 flag `use_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. ```python theme={null} circuit = QuantumCircuit(2) circuit.h(0) circuit.cx(0, 1) circuit.measure_all() ``` **2. Specify execution details** Set your target device, credentials, and number of shots. ```python theme={null} device = haiqu.get_device("ibm_torino") options = { "ibm_quantum_token": "", "ibm_quantum_instance": "", } shots = 1000 ``` > [!TIP] > > Instead of adding credentials to `options` every time, consider saving them using `save_aws_credentials()` or `save_ibm_credentials()`. **3. Run with error mitigation** Pass `use_mitigation=True` to `haiqu.run`. The SDK applies the distribution-mode mitigation pipeline automatically. ```python theme={null} job = haiqu.run( circuits=circuit, device=device, options=options, shots=shots, use_mitigation=True, ) job.progress() print(job.result()) ``` *** ## 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. ```python theme={null} circuit = QuantumCircuit(2) circuit.h(0) circuit.cx(0, 1) observables = [SparsePauliOp.from_list([("XY", 0.75), ("XX", -0.25)])] ``` **2. Specify execution details** Set your target device, credentials, and number of shots. ```python theme={null} device = haiqu.get_device("ibm_torino") options = { "ibm_quantum_token": "", "ibm_quantum_instance": "", } shots = 1000 ``` > [!TIP] > > Instead of adding credentials to `options` every time, consider saving them using `save_aws_credentials()` or `save_ibm_credentials()`. **3. Run with error mitigation** Pass both `observables` and `use_mitigation=True`. The SDK detects the observable and selects the appropriate mitigation pipeline automatically. ```python theme={null} job = haiqu.run( circuits=circuit, observables=observables, device=device, options=options, shots=shots, use_mitigation=True, ) job.progress() print(job.result()) ``` *** ## 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. | Option | Default | Description | | :- | :- | :- | | `"dynamical_decoupling"` | `True` | Insert DD pulse sequences to suppress idle-qubit decoherence during execution | | `"readout_mitigation"` | `True` | Correct bitflip errors introduced during qubit measurement | | `"noise_tailoring"` | `False` | Apply Pauli twirling to convert coherent noise into stochastic noise, improving the effectiveness of downstream mitigation | | `"advanced_mitigation"` | `True` | Enable the full advanced mitigation pipeline | Example — enabling noise tailoring while keeping all other defaults: ```python theme={null} options = { "ibm_quantum_token": "", "ibm_quantum_instance": "", "error_mitigation_options": { "noise_tailoring": True, }, } ``` > [!TIP] > > `"error_mitigation_options"` only takes effect when `use_mitigation=True`. Flags not included in the dictionary retain their defaults. *** ## Error Mitigation Details | | **Observable** | **Distribution** | | :- | :- | :- | | **Supported backends** | IBM QPUs, AWS Braket (TBD) | IBM QPUs, AWS Braket (TBD) | | **Circuit format** | Qiskit QuantumCircuit | Qiskit QuantumCircuit | | **Max. qubit number** | up to 156 qubits (largest QPU) | up to 156 (diminished efficiency with sampling) | | **Max. circuit depth / gate count** | up to 1000 2q gates for up to weight-5 observables, up to 300 2q gates for non-local observables | | | **Circuit overhead** | 2x circuit overhead per unique circuit | 2x the number of unique circuits (noise learning) | | **Shot overhead** | 2x shot overhead per unique circuit | 2x the number of unique circuits (noise learning) | | **Execution speed** | O(1) seconds for QEM + execution time on QPU | O(1) seconds for QEM + execution time on QPU | # Experiment Tracking Source: https://docs.haiqu.ai/core_features/exp_tracking Organize, track, and manage your quantum experiments, circuits, and jobs in Haiqu SDK ## How to track your workloads In the Haiqu SDK, you can make use of experiment tracking to keep your circuits and jobs organized. Every circuit you log and/or execute is connected to an experiment. So are the jobs that you run. Let's see how this works in the following simple example: **1. Initialize an Experiment** Create a new experiment to keep your circuits and jobs organized. ```python theme={null} from haiqu.sdk import haiqu # Login with your API key haiqu.login() # Create a new experiment haiqu.init("Hello Quantum World!") ``` > [!TIP] > > All your circuits and jobs will now be tracked under this experiment until you initialize a new one. **2. View and Switch Experiments** List your experiments and switch between them as needed. ```python theme={null} # View all experiments haiqu.list_experiments() # Switch to another experiment haiqu.init("Hello Again!") ``` > [!NOTE] > > If you don't create an experiment, a default one is used automatically. **3. Log a Circuit** Add circuits to your experiment for tracking and re-use. ```python theme={null} from qiskit import QuantumCircuit # Create a Bell state circuit qc = QuantumCircuit(2) qc.h(0) qc.cx(0, 1) qc.measure_all() # Log the circuit haiqu_circuit = haiqu.log(qc, name="Bell state", description="A simple Bell state circuit") # View all circuits in the current experiment haiqu.list_circuits() ``` > [!TIP] > > You can now track, analyze, and re-run the logged circuits later. **4. Run a Job** Execute your logged circuit and track the job's progress. ```python theme={null} # Run the circuit on a simulator job = haiqu.run( circuits=haiqu_circuit, shots=1000, device_id="aer_simulator", job_name="Bell state execution", job_description="Executing Bell state on Aer simulator" ) # Monitor progress job.progress() # Check status print(job.retrieve_status()) # View all jobs in the current experiment haiqu.list_jobs() ``` > [!TIP] > > Jobs are automatically linked to the experiment and circuit. **5. Retrieve Past Work** Easily load circuits or jobs from your history. ```python theme={null} # Get a circuit by ID loaded_circuit = haiqu.get_circuit(haiqu_circuit.id) haiqu.draw(loaded_circuit) # Get a job by ID and check status loaded_job = haiqu.get_job(job.id) loaded_job.retrieve_status() ``` > [!NOTE] > > You can also search jobs by the circuit they executed using `haiqu.list_jobs(circuit=)`. > [!NOTE] > > All list objects methods, such as `haiqu.list_jobs`,`haiqu.list_circuits` \ > and `haiqu.list_experiments` by default render an HTML widget and return `None`.\ > **Use**`widget=False`**keyword argument in any of the aforementioned functions to return a list of objects**. Alternatively, use `pandas=True` to return a `pandas.DataFrame`object with the same information. See [SDK Reference | List Objects](https://docs.haiqu.ai/reference/core/list) for more information and examples. ## Other use-cases Here are some additional features you can use when working with experiments. #### Retrieve lists of experiments, jobs and circuits as objects In some cases, it is more useful to work with the list of objects, in order to do automated result tracking, advanced filtering, mass job cancellation, or when working outside of Jupyter. By default, when a function like `haiqu.list_experiments`, `haiqu.list_jobs` and `haiqu.list_circuits` is called, an HTML widget is rendered and displayed in the Jupyter cell output and `None` is returned. This can be changed by setting keyword argument `widget=False` in any of such functions. This makes the functions return `list[Experiment]`, `list[BaseJobModel]` and `list[CircuitModel]`, depending on the function. See [SDK Reference | List Objects](/reference/core/list) for more information and examples. A few code snippets are provided below to showcase potential use-cases: **Get list or pandas dataframe of experiments** ```python theme={null} exps = haiqu.list_experiments(widget=False) # List of Experiment objects df_exps = haiqu.list_experiments(widget=False, pandas=True) # Pandas DataFrame ``` **Check current status of all jobs** ```python theme={null} job_statuses = {} jobs = haiqu.list_jobs(widget=False) for job in jobs: job_statuses[job.id] = job.retrieve_status() ``` #### List circuits from another experiment By default, only circuits that belong to the current experiment are returned. It is possible to change this by specifying the `experiment_id` keyword argument. Use `haiqu.list_experiments` function to view available experiments. ```python theme={null} haiqu.list_circuits(experiment_id=) ``` #### Track job execution in real time A blocking call that renders a HTML widget with logs that get updated in real time. The function only returns when the job finished running. ```python theme={null} job.progress() ``` #### Access job logs Access the current logs for a job as a string. Non-blocking. ```python theme={null} print(job.logs) ``` # Experiment Sharing Source: https://docs.haiqu.ai/core_features/experiment-sharing Fetch circuits and jobs from existing Haiqu experiments ## How to share experiments To share an experiment, open the experiment page and click the **Private/Public** sharing button. In the dialog that appears, add your coworker's email address or select a team, then choose the appropriate permission level (view or edit). Shared users will be able to access the experiment according to the permissions you grant, including its jobs, circuits, descriptions. ![Image](https://mintcdn.com/haiqu/Pk-D2qHReFtjw0XX/images/image-6.png?fit=max\&auto=format\&n=Pk-D2qHReFtjw0XX\&q=85\&s=c3a0b932dfd70920500d9135b01cd575) ## How to fetch jobs and circuits In Haiqu, every job and circuit belongs to an experiment. If you've been invited to collaborate on an experiment, you can view and retrieve all of the jobs, circuits, and other assets associated with that experiment, subject to the permissions you've been granted. **1. Login and Initialize** ```python theme={null} from dotenv import load_dotenv from haiqu.sdk import haiqu load_dotenv() haiqu.login() EXPERIMENT_ID = "exp-04ea4655-d5a7-4df5-8d45-d76a65521ce2" haiqu.init(EXPERIMENT_ID) ``` **2. List Jobs** ```python theme={null} df_jobs = haiqu.list_jobs(experiment_id=EXPERIMENT_ID, widget=False, pandas=True) ``` **3. Retrieve Job by ID** ```python theme={null} job = haiqu.get_job(jobs[0].id) job.retrieve_status() ``` **4. List Circuits** ```python theme={null} df_circuits = haiqu.list_circuits(experiment_id=EXPERIMENT_ID, widget=False, pandas=True) ``` **5. Retrieve Circuit by ID** ```python theme={null} circuit = haiqu.get_circuit(circuits[0].id) haiqu.draw(circuit) ``` ## Other use-cases #### List jobs for a circuit ```python theme={null} haiqu.list_jobs(circuit="", widget=False) ``` #### List circuits from another experiment ```python theme={null} haiqu.list_circuits(experiment_id=EXPERIMENT_ID, widget=False) ``` # Working with Haiqu Circuits Source: https://docs.haiqu.ai/core_features/haiqu_circuits Compose, transpile, execute, and measure opaque Haiqu-generated circuits — and why local Qiskit tooling fails on them Data-loading job results return a `HaiquCircuitGate`: an **opaque handle to a circuit stored in the Haiqu cloud**. The gate carries only a `circuit_id` and qubit count — its `definition` is `None`, and it is expanded server-side when you transpile or run it. [State compression](/core_features/compression) job results return a `CircuitModel` instead. Pass it directly to `haiqu.transpile` or `haiqu.run`, call `.to_gate()` to embed it in a larger Qiskit circuit, and persist `result.id` if you need to retrieve it later with `haiqu.get_circuit`. You can also obtain a `HaiquCircuitGate` from any cloud-stored circuit via `haiqu.get_circuit(circuit_id).to_gate()`. This page explains what works on these circuits, what fails, and how to read depth and gate counts from cloud-computed analytics. ## What works and what doesn't | Task | Use | Doesn't work | | :- | :- | :- | | Embed in a larger circuit | `circuit.append(gate, ...)`, `circuit.compose(...)` | — | | Invert | `gate.inverse()` (returns the dagger gate) | — | | Transpile | `haiqu.transpile(circuit, device)` | local `qiskit.transpile` / `circuit.decompose()` on opaque gates | | Depth / gate counts | `haiqu.transpile(...).analytics` (e.g. `.depth`, `.depth_2q`, `.gates_2q`) or `.core_metrics(widget=False)` | `qc.depth()` / local counts on opaque gates | | Execute | `haiqu.run(...)`, `haiqu.statevector_run(...)` | local Aer, `Statevector` | | Persist a cloud circuit | store `circuit.id`; retrieve with `haiqu.get_circuit(circuit_id)` | pickling `CircuitModel` objects | Composition works because `HaiquCircuitGate` is a regular `qiskit.circuit.Instruction` — you can freely build hybrid algorithms around it. Only operations that need the gate's *contents* fail locally, because the contents live in the cloud. ## Local pitfalls Local expansion does not work on circuits containing opaque gates: ```python theme={null} from qiskit import transpile transpile(circuit_with_haiqu_gate, basis_gates=["u", "cx"]) # cannot expand the server-side circuit definition circuit_with_haiqu_gate.decompose() # same — use haiqu.transpile instead circuit_with_haiqu_gate.depth() # misleading: the opaque gate counts as one instruction ``` ## Cloud analytics Structure metrics are computed cloud-side on the `CircuitModel` returned by `haiqu.transpile` and exposed through [Circuit Analytics](/core_features/circ_analytics): ```python theme={null} device = haiqu.get_device("fake_torino") transpiled = haiqu.transpile(circuit, device) depth = transpiled.analytics.depth depth_2q = transpiled.analytics.depth_2q gates_2q = transpiled.analytics.gates_2q # or as a dict of core metrics: metrics = transpiled.core_metrics(widget=False) ``` If `analytics` is not yet populated, call `core_metrics(widget=False)` or `wait_for_analytics(widget=False)` — both block until metrics are ready. ## Executing and validating Circuits containing Haiqu gates execute through [`haiqu.run`](/reference/run/run) like any other circuit — the cloud expands the gate at submission time. For small circuits (up to 20 qubits, non-parameterized) `statevector_run` returns exact amplitudes, which is useful for validating a loaded state against its classical target. # SDK Overview Source: https://docs.haiqu.ai/core_features/overview ![Features 1](https://mintcdn.com/haiqu/mTOeJYFBGWw8n8UA/images/Features-1.png?fit=max\&auto=format\&n=mTOeJYFBGWw8n8UA\&q=85\&s=51fa4cf40d8cb051381dec2a3dc31012) Haiqu gets users better solutions at lower cost on quantum computers. It improves every step of the process, from preparing data to running programs on quantum hardware. The platform automatically optimizes quantum workloads so they use fewer resources and produce higher-quality results. It easily works with different providers, including IBM, IonQ, and IQM, helping users achieve the best possible performance on available hardware. ![Sequence Diagram](https://mintcdn.com/haiqu/BKafG6wYm3A0BupA/images/sequence_diagram.png?fit=max\&auto=format\&n=BKafG6wYm3A0BupA\&q=85\&s=0f0481b6e5a222ac74d634f043111ce3) Haiqu serves as the intelligent orchestration layer between user applications and quantum hardware, managing the entire execution workflow from optimization to results delivery. When a user submits an application, Haiqu preprocesses and optimizes the workload, translates it into hardware-specific quantum tasks, and dispatches those tasks to the target QPU. After execution on the quantum processor, the results are returned to Haiqu for post-processing, interpretation, and formatting before being delivered back to the user. By abstracting the complexities of quantum hardware and execution, Haiqu enables seamless, efficient, and hardware-agnostic quantum computing workflows. # Optimization & Postprocessing Source: https://docs.haiqu.ai/core_features/postprocessing Classical enhancement of your quantum optimization for the best performance. Complementary to the tools that allow you to execute quantum optimization algorithms on QPU (see LR-QAOA benchmark in the [Data Sheet](../catalog/datasheet)), Haiqu SDK offers utility functionality to perform classical postprocessing of the results acquired from a QPU when solving an optimization problem. Here is how your workflow might look: **1. Define your optimization problem** First, you need to define your optimization problem. Haiqu currently supports the quadratic unconstrained binary optimization (QUBO) problems that can be initialized with the corresponding class: ```python theme={null} from haiqu.sdk.optimization import QUBO # the problem can be initialized from a CPLEX/LP file problem = QUBO.from_file("FILEPATH.lp") ``` > [!TIP] > > If defining a problem from scratch, you can also initialize from a graph object using `QUBO.from_graph()` or `QUBO.from_hamiltonian()` if you already have a Hamiltonian defined. **2. Execute the workload on hardware** Whether you are using your own method or constructing an LR-QAOA circuit with Haiqu, you need to execute the circuit on a device or simulator using `haiqu.run`: ```python theme={null} circuit = haiqu.build_lr_qaoa_circuit(problem) job = haiqu.run(circuit, shots=1000, device_id="aer_simulator") raw_counts = job.result()[0] ``` **3. Postprocess the counts classically** After retrieving the sampled bitstrings from the QPU, you may want to postprocess the results using a classical algorithm (e.g. a local bitflip search): ```python theme={null} from haiqu.sdk.optimization import cvar_expectation # Compute raw costs using the QUBO object's .cost() method # (Qiskit little-endian; no manual bitstring reversal needed). raw_costs = {bitstring: optimization_problem.cost(bitstring) for bitstring in raw_counts.keys()} # Apply server-side postprocessing (bitflip local search, runs on the Haiqu API). # Returns (processed_costs, processed_counts). processed_costs, processed_counts = haiqu.postprocess( counts=raw_counts, problem=optimization_problem, postprocess_iterations=5, ) # CVaR expectation over the raw distribution. alpha=1.0 is the full mean; # alpha=0.1 averages over the best 10% of samples by cost. standard_expectation = cvar_expectation(raw_counts, problem=optimization_problem, alpha=1.0) cvar_10_percent = cvar_expectation(raw_counts, problem=optimization_problem, alpha=0.1) ``` Here is how postprocessing might affect your QPU results: ![21b0c7cf-cbed-433a-9459-8514b7e065ab.png](https://mintcdn.com/haiqu/QnjSg02a6HjnZweN/images/21b0c7cf-cbed-433a-9459-8514b7e065ab.png?fit=max\&auto=format\&n=QnjSg02a6HjnZweN\&q=85\&s=f8455be3947cff99668221faa66b4c04) # Variational algorithms Source: https://docs.haiqu.ai/core_features/qml Execute variational quantum algorithms ## Variational optimization with Haiqu SDK Use `haiqu.variational_optimization()` to minimize the expectation value of an observable for a parameterized ansatz circuit. **1. Define the variational problem** ```python theme={null} from qiskit.circuit.library import EfficientSU2 from qiskit.quantum_info import SparsePauliOp from haiqu.sdk.qml import VariationalProblem #Build a parameterized QuantumCircuit (ansatz) num_qubits = 3 ansatz = EfficientSU2(num_qubits=num_qubits, reps=1) #Define the cost observable as SparsePauliOp observable = SparsePauliOp.from_list([("Z" * num_qubits, 1.0)]) # Wrap both in VariationalProblem problem = VariationalProblem(ansatz, observable) ``` > [!NOTE] > > `VariationalProblem` requires a parameterized ansatz circuit and a `SparsePauliOp` observable. **2. Configure optimizer and submit the job** **NFT (default)** ```python theme={null} from haiqu.sdk import haiqu from haiqu.sdk.qml import NFTOptimizerOptions optimizer_options = NFTOptimizerOptions( maxiter=100, maxfev=200, reset_interval=32, randomized_order=False, ) job = haiqu.variational_optimization( problem=problem, device_id="aer_simulator", shots=1000, seed=42, optimizer_options=optimizer_options, use_mitigation=False, use_session=False, ) ``` **Scipy** ```python theme={null} from haiqu.sdk import haiqu from haiqu.sdk.qml import ScipyOptimizerOptions optimizer_options = ScipyOptimizerOptions( method="cobyla", maxfev=200, options={"rhobeg": 0.5}, ) job = haiqu.variational_optimization( problem=problem, device_id="aer_simulator", shots=1000, seed=42, optimizer_options=optimizer_options, use_mitigation=False, use_session=False, ) ``` **3. Track progress and fetch results** ```python theme={null} job.progress() result = job.result() print("Minimum loss:", result.min_loss) print("Optimal parameters:", result.optimal_parameters) print("Iterations:", len(result.loss_history)) ``` > [!TIP] > > `job.result()` returns a `VariationalResult` with `min_loss`, `optimal_parameters`, and `loss_history`. ## API details The variational optimisation function is defined as: ```python theme={null} haiqu.variational_optimization( problem, shots=1000, device=None, device_id=None, options=None, initial_parameters=None, seed=None, optimizer_options=None, use_mitigation=False, use_session=False, ) ``` | Argument | Description | | :- | :- | | `problem` | `VariationalProblem(ansatz, observable)` | | `device` / `device_id` | Target backend. At least one must be provided. | | `shots` | Number of shots per circuit evaluation. | | `seed` | Reproducible random initialization in `[-0.1π, 0.1π]`. | | `initial_parameters` | Explicit initial values (length must match ansatz parameters). | | `optimizer_options` | Optimizer configuration. Either `NFTOptimizerOptions(...)` (default) or `ScipyOptimizerOptions(method=..., maxfev=..., options=...)`. | | `use_mitigation` | Enables mitigation pipeline in backend execution. | | `use_session` | Enables Qiskit Runtime Session mode. | ## Optimizer details `haiqu.variational_optimization` accepts two optimizer types via `optimizer_options`: `NFTOptimizerOptions` (the default) and `ScipyOptimizerOptions`. Both are gradient-free. ### NFT (default) Haiqu uses the [NFT](https://arxiv.org/abs/1903.12166) optimizer by default for variational optimization. NFT, short for Nakanishi-Fujii-Todo, is a gradient-free optimizer designed for parameterized quantum circuits. Instead of estimating a full gradient, NFT updates circuit parameters sequentially. For a common class of ansatz circuits, the cost function as a function of one parameter has a simple trigonometric form, so each parameter update can be minimized efficiently from a small number of cost evaluations. This makes NFT a good default choice for noisy variational workloads: * It is gradient-free, so it avoids the high measurement cost of full gradient estimation. * It is efficient compared with many general-purpose gradient-free optimizers. * Recent scaling studies also rank NFT among the more noise-resilient classical optimizers, while showing that stochastic noise can still create serious scalability challenges for large variational optimization problems; see [Scalability challenges in variational quantum optimization under stochastic noise](https://journals.aps.org/pra/abstract/10.1103/rgyh-8xw8). #### Requirements and limitations NFT assumes the variational problem satisfies the following preconditions: * **Independent parameters:** each ansatz parameter should be independent. Reusing the same parameter across multiple rotation gates is not supported by the standard NFT update rule. * **Supported gate structure:** the parameterized circuit should be composed of fixed unitary gates and rotation gates of the form `R_j(theta_j) = exp(-i * theta_j * A_j / 2)`, where `A_j^2 = I`. * **Simple expectation-value cost:** the objective should be a weighted sum of expectation values, `L(theta) = Σ_k w_k `. > [!NOTE] > > NFT can improve optimizer robustness, but it does not remove the fundamental sampling and noise-scaling challenges of variational quantum algorithms. ### Derivative-free scipy methods For ansatz / problem combinations that violate NFT's preconditions, or for comparison against established baselines, `ScipyOptimizerOptions` dispatches to any of four derivative-free `scipy.optimize.minimize` methods: * **`cobyla`:** Constrained Optimization BY Linear Approximation. Trust-region method with linear surrogates. * **`nelder-mead`:** Downhill simplex. No surrogate model; forgiving on noisy or non-smooth objectives but tends to need more evaluations. * **`powell`:** Direction-set method that minimizes along conjugate directions. * **`cobyqa`:** COBYLA's quadratic-approximation successor; usually higher quality per evaluation at modest extra cost. `maxfev` is exposed as a typed top-level field (default 200). Everything else flows through the free-form `options` dict, validated at construction time against a per-method whitelist: | Method | Allowed `options` keys | | :- | :- | | `cobyla` | `rhobeg`, `catol`, `disp` | | `nelder-mead` | `xatol`, `fatol`, `adaptive`, `disp` | | `powell` | `xtol`, `ftol`, `direc`, `disp` | | `cobyqa` | `rhobeg`, `final_tr_radius`, `disp` | Example: ```python theme={null} from haiqu.sdk.qml import ScipyOptimizerOptions optimizer_options = ScipyOptimizerOptions( method="cobyla", maxfev=200, options={"rhobeg": 0.5}, ) ``` > [!NOTE] > > Scipy methods can wander after they find a good point, so Haiqu returns the best-so-far parameters tracked across the optimization, not the final scipy iterate. # Job Performance Metrics Source: https://docs.haiqu.ai/core_features/quality The job table lists key execution metrics for each run. ![Image](https://mintcdn.com/haiqu/Qai8yI47cOs_ILG8/images/image-1.png?fit=max\&auto=format\&n=Qai8yI47cOs_ILG8\&q=85\&s=a0fe0d6e0d5a520b3ec457123e853cd3) ### QPU Quality The **QPU Quality** metric measures how closely the results produced by the QPU match those obtained from classical simulation. This comparison provides an indication of solution fidelity and execution accuracy. QPU Quality evaluation is currently supported for circuits using fewer than 20 qubits, where classical simulation remains computationally feasible. ### QPU Cost The **QPU Cost** metric represents the total quantum processing cost associated with executing the job on quantum hardware. Costs are estimated before the run based on factors such as hardware usage time, circuit complexity, and provider-specific pricing models. After the run concludes, the costs are updated to reflect actual usage. ### CPU Time The **CPU Time** metric captures the classical compute time used for pre-processing and post-processing tasks associated with the job. This includes operations such as compression, transpilation, mitigation, optimization, and analysis. CPU Time is charged in Haiqu credits. # Measuring in different bases Source: https://docs.haiqu.ai/core_features/readout_bases Measuring your circuits in different Pauli bases and getting counts back ## What it does By default a circuit with measurements is read out in the computational (Z) basis, so you get counts of Z-basis bitstrings. `readout_bases` rotates the qubits into a different Pauli basis just before readout, and still returns **counts** — one distribution per basis, per circuit. This is different from passing `observables`. Observables give you expectation values, with the distribution collapsed away. Readout bases keep the full distribution, so you can compute your own estimators, look at correlations, or do basis-resolved tomography-style analysis. ```python theme={null} counts = haiqu.run( circuit, shots=8000, device_id="aer_simulator", readout_bases=["XX", "ZZ"], ).result_by_basis()[0] counts["XX"] # distribution measured in the X basis counts["ZZ"] # distribution measured in the Z basis ``` > [!NOTE] > > Your circuits keep their own measurements, exactly as for a normal distribution job. Haiqu > strips the final measurements, inserts the basis rotation, and re-measures. *** ## Basis strings and qubit order A basis is one Pauli character per qubit, using **Qiskit's little-endian convention** — the same one `observables` uses. The **last** character applies to qubit 0: ``` basis = "X Z Y Z" qubit = 3 2 1 0 ``` Only `X`, `Y` and `Z` are allowed. Use `Z` for a qubit you do not want rotated. **1. Build a circuit whose basis you can predict** Put qubit 0 into `|+⟩` and leave qubit 1 in `|0⟩`. ```python theme={null} from qiskit import QuantumCircuit circuit = QuantumCircuit(2) circuit.h(0) circuit.measure_all() ``` **2. Read qubit 0 in X and qubit 1 in Z** Because the last character is qubit 0, the basis is `"ZX"` — **not** `"XZ"`. ```python theme={null} job = haiqu.run( circuit, shots=8000, device_id="aer_simulator", readout_bases=["ZX", "XZ"], ) ``` **3. Check the result** `|+⟩` is an X eigenstate and `|0⟩` is a Z eigenstate, so `"ZX"` is deterministic. Reading the same state in `"XZ"` measures qubit 0 in Z and qubit 1 in X, which is uniformly random. ```python theme={null} by_basis = job.result_by_basis()[0] by_basis["ZX"] # {'00': 1.0} by_basis["XZ"] # {'00': 0.249, '01': 0.258, '10': 0.246, '11': 0.248} ``` > [!TIP] > > If a basis you expect to be deterministic comes back uniform, you have almost certainly written > the string in big-endian order. Reverse it. *** ## Reading the results Results gain one nesting level for the basis axis, in the order you supplied the bases: | Job | Nesting | | - | - | | No parameters | `[circuit][basis]` | | With a parameter sweep | `[circuit][basis][parameter]` | `result_by_basis()` saves you from indexing by position — it returns one dict per circuit, keyed by the basis string: ```python theme={null} job = haiqu.run( circuits=[circuit_a, circuit_b], shots=8000, device_id="aer_simulator", readout_bases=["XX", "YY", "ZZ"], ) for index, by_basis in enumerate(job.result_by_basis()): for basis, distribution in by_basis.items(): print(f"circuit {index}, basis {basis}: {distribution}") ``` The keys are unambiguous because duplicate bases are rejected at submission. > [!NOTE] > > `result_by_basis()` blocks until the job reaches a terminal state, like `result()`. Use > `retrieve_status()` first if you do not want to block. *** ## Cost Each basis is a separate execution of the circuit, so a job costs `len(readout_bases) * shots` shots in total. Three bases at 8000 shots is 24000 shots on the device. What you do **not** pay twice for is compilation: all bases of a circuit share a single transpilation and a single layout, because the rotation is applied after transpilation. The bases are therefore directly comparable — they run on the same physical qubits with the same routing. *** ## Combining with other features > **Error mitigation** > > `use_mitigation=True` works as usual. Readout error acts on the post-rotation bitstring, which > is exactly what the mitigation stack models, so no special handling is needed. > > ```python theme={null} > job = haiqu.run( > circuit, > shots=8000, > device_id="ibm_torino", > readout_bases=["XX", "ZZ"], > use_mitigation=True, > ) > ``` > **Circuit packing** > > `use_packing=True` is supported. Packing replicates one circuit across the device, and every > copy is read out in the same basis, so a basis string still has one character per **circuit** > qubit — not per packed qubit. > > ```python theme={null} > job = haiqu.run( > circuit, > shots=8000, > device_id="ibm_torino", > readout_bases=["ZX"], > use_packing=True, > pack_size=2, > ) > ``` > **Parameterized circuits** > > Parameters combine freely with bases. The parameter axis is the inner one, so > `result()[circuit][basis][parameter]`. > > ```python theme={null} > job = haiqu.run( > parameterized_circuit, > parameters=[[0.0], [3.14159]], > shots=8000, > device_id="aer_simulator", > readout_bases=["X", "Z"], > ) > ``` > **Hybrid programs** > > In a hybrid program, add a `ReadoutBasisLayer` to mark where the rotation happens, and pass > the bases to `flow()`. Place the layer after the transpilation layer so all bases share one > transpilation. > > ```python theme={null} > from haiqu.sdk.hybrid import HybridProgram, layers > > program = HybridProgram( > layers=[ > layers.InputLayer(), > layers.TranspilationLayer(), > layers.ReadoutBasisLayer(), > layers.DeviceLayer(device_id="aer_simulator"), > ] > ) > > job = haiqu.flow( > program=program, > circuits=circuit, > shots=8000, > readout_bases=["XX", "ZZ"], > ) > ``` > > The layer and the bases go together: supplying one without the other is rejected, because a > layer with no bases would silently return computational-basis counts. *** ## Rules and limits A submission is rejected if any of these does not hold: | Rule | Why | | - | - | | No `observables` at the same time | Observables return expectation values, bases return distributions. Submit separate jobs. | | Characters from `X`, `Y`, `Z` only | Use `Z` for an unrotated qubit; `I` is not accepted, to keep the meaning unambiguous. | | No duplicate bases | Results are keyed by basis, so a repeated basis would be ambiguous. | | All bases the same length | One character per qubit, so every basis covers the same register. | | One character per circuit qubit | Checked against the circuit width, or against the active qubits when the circuit is already transpiled. | | `run_type` is not `StatevectorRun` | A statevector run returns amplitudes, not counts; a basis rotation there is a local change of frame you can apply yourself. | # Transpilation Source: https://docs.haiqu.ai/core_features/transpilation Cloud-side transpilation to any device, comparing transpilations, and the only transpilation path for circuits with Haiqu-generated gates ## Why and how to transpile your circuits Most quantum computers do not support arbitrary operations, but implement quantum computation using specific gates from a universal gateset. It is therefore necessary to convert a quantum circuit, consisting of various quantum operations, to one compatible with a specific physical quantum hardware device before executing the circuit on the device. This process is called transpilation. While Haiqu SDK takes care of transpilation automatically when you submit your circuits using the `haiqu.run` function, it may be useful to transpile your circuits and inspect the relations between the circuit characteristics and transpilation parameters. Haiqu SDK uses the open-source [Rivet Transpiler](https://github.com/haiqu-ai/rivet) for transpilation of your circuits. Transpiling a circuit is straightforward: ```python theme={null} device = haiqu.get_device("fake_torino") transpiled_circuit = haiqu.transpile(circuit, device) ``` Every circuit stores the information about its transpiled versions, which can be viewed using: ```python theme={null} haiqu.list_transpiled_circuits(circuit) ``` ![Light mode interface](https://mintcdn.com/haiqu/QnjSg02a6HjnZweN/images/list_transpiled_circuits_light.png?fit=max\&auto=format\&n=QnjSg02a6HjnZweN\&q=85\&s=fc3eca8c7c83ecdd84f7dff375a1f044) ## Comparing transpilations As `haiqu.transpile` offers a large number of parameters that allow you to customize the transpilation, such as `optimization_level`, `initial_layout`, `basis_gates` (for more details see the [documentation of Rivet](https://haiqu-ai.github.io/rivet/index.html)), it may sometimes be useful to compare the circuits resulting from transpilation with different parameters. For instance, one can change the optimization level during transpilation: ```python theme={null} transpiled_circuit_opt0 = haiqu.transpile(circuit, device, optimization_level=0) transpiled_circuit_opt3 = haiqu.transpile(circuit, device, optimization_level=3) ``` It is then convenient to compare the resulting circuits using `haiqu.compare_metrics` function: ```python theme={null} haiqu.compare_metrics(transpiled_circuit_opt0, transpiled_circuit_opt3) ``` ![Light mode interface](https://mintcdn.com/haiqu/QnjSg02a6HjnZweN/images/compare_metrics_image_light.png?fit=max\&auto=format\&n=QnjSg02a6HjnZweN\&q=85\&s=364066263f73bfab94938b307c3f8b74) ### Transpiling with custom basis gates and coupling maps `haiqu.transpile` also allows you to override device constraints, such as `basis_gates` and `coupling_map`. This is useful for simulator experiments or for studying how different hardware constraints affect circuit depth, gate counts, and other metrics. For example, to transpile with an all-to-all connectivity and a custom gate set: ```python theme={null} device = haiqu.get_device("aer_simulator") transpiled_circuit = haiqu.transpile( circuit, device, basis_gates=["cx", "u3"] ) ``` This mirrors Qiskit’s `transpile` behavior, where explicitly provided `basis_gates` or `coupling_map` can override the backend constraints. # Dashboard Overview Source: https://docs.haiqu.ai/dashboard-overview ## Home ![Image](https://mintcdn.com/haiqu/V6xpJKRipU1sipdE/images/image-10.png?fit=max\&auto=format\&n=V6xpJKRipU1sipdE\&q=85\&s=380b0650d6c0aaed954fa27170c57db0) The **Haiqu Dashboard** provides a central view of your quantum computing activity, available resources, experiments, and hardware. From here, you can quickly understand your current usage, access recent work, and identify available quantum devices. Your API key for connecting the Haiqu SDK and running workloads programmatically is also accessible from the upper-right corner of the dashboard. At the top of the dashboard, the **Compute Execution Summary** shows your available and consumed Haiqu compute hours. These hours include classical pre-processing and post-processing compute used to enhance your execution on quantum hardware. The overview also summarizes the number of experiments and jobs associated with your account, including how many jobs have finished, are currently running, or have failed. This provides a quick snapshot of both resource consumption and execution activity. The **Public Experiments** section provides access to experiments shared through the Haiqu community. Experiment cards include a preview and description, making it easy to discover example workflows and explore how other users are applying Haiqu. You can switch between **Public** experiments and experiments **Shared with me** to access work shared directly with your account. The **Devices** section provides an overview of quantum hardware available through Haiqu. For each device, the dashboard displays information such as the provider, processor type, number of qubits, current status, queue, quality metrics, pricing information, and recent load. This makes it easier to compare available backends and select an appropriate device before submitting a workload. The navigation menu on the left provides direct access to **Jobs, Experiments, Devices, Haiqu Lab, usage analytics, error-correction resources, documentation, GitHub examples, pricing, and other platform resources**. # Experiment Page ## Experiment Description ![Image](https://mintcdn.com/haiqu/V6xpJKRipU1sipdE/images/image-13.png?fit=max\&auto=format\&n=V6xpJKRipU1sipdE\&q=85\&s=9c40c60726e11220ff9b165898696e5b) The **Experiment** page provides a central workspace for organizing, analyzing, and sharing the results of runs. The experiment **description** can be used to highlight the main findings. Supporting **Artifacts** are collected below the main result and can include pipeline diagrams, source data, intermediate outputs, and individual execution results. Together, these artifacts can be added to the description to provide context needed to understand how the experiment was performed and compare results across different configurations. ## Circuit Table ![Image](https://mintcdn.com/haiqu/V6xpJKRipU1sipdE/images/image-15.png?fit=max\&auto=format\&n=V6xpJKRipU1sipdE\&q=85\&s=3fcbf065a4c3e8471c8f91f0ff93efc6) The **Circuits Table** provides a detailed comparison of the circuits associated with an experiment, including both the original circuits and their transformed or transpiled versions. For each circuit, the table shows its source and target device alongside key resource metrics such as **estimated fidelity, active qubits, circuit depth, and gate counts**, with separate values for two-qubit operations. Related circuits are visually connected, making it easy to compare a source circuit with its modified implementation and understand how compilation or Haiqu optimizations affect circuit size, complexity, and expected performance. Circuits can also be searched, filtered, downloaded, or opened for more detailed inspection. ## Jobs Table ![Image](https://mintcdn.com/haiqu/V6xpJKRipU1sipdE/images/image-11.png?fit=max\&auto=format\&n=V6xpJKRipU1sipdE\&q=85\&s=9d5e49abc5163a3d713fd21565ed26d2) The **Experiment Jobs** view provides a centralized overview of all jobs within an experiment. Each row summarizes key execution information, including the job configuration, status, job type, backend, creation time, **QPU quality**, CPU processing time, and QPU cost. This makes it easy to compare different configurations and understand their impact on solution quality, runtime, and hardware cost. Jobs can be searched, filtered by type, status, or backend, and sorted to quickly identify relevant runs. Additional controls provide access to job-specific results and details, while the experiment data can also be downloaded for further analysis. # Account & Credits Source: https://docs.haiqu.ai/dashboard/account Credits, Haiqu Lab, getting help and troubleshooting ## Credits A run on quantum hardware has two separate costs: | | Haiqu credits | QPU cost | | - | - | - | | **Pays for** | Classical compute Haiqu does for your job: transpilation, compression, error mitigation, post-processing | Running the circuits on the provider's hardware | | **Measured as** | **CPU Time**, in hours | The provider's price per task and per shot | | **Paid to** | Haiqu, from your credit balance | The hardware provider, through your provider account | | **Where you see it** | **Available** / **Spent** on the [Dashboard home](/dashboard/home#compute-execution-summary); **CPU Time** per job | **Price** on [Devices](/dashboard/devices); **QPU Cost** per job ([Jobs](/dashboard/jobs#metrics-in-the-table)) | Need more credits? Open **Pricing** in the sidebar and send us a request. When your balance reaches zero, the Dashboard shows a link to the same form. ## API key Your API key is on the [Dashboard home](/dashboard/home#api-key). If it may have leaked, rotate it there. The old key stops working at once and Haiqu Lab restarts. ## Haiqu Lab If Haiqu Lab is enabled for your account, **Haiqu Lab** in the sidebar opens your hosted JupyterLab. The **Lab Notebook** button on an experiment opens the notebook that experiment was run from. ## Getting help * **Need help?** in the bottom-right corner of every page opens Slack support, or copies our support e-mail address. * **Feedback** in the sidebar opens [feedback.haiqu.ai](https://feedback.haiqu.ai). ## Troubleshooting > **“Access denied or not found” when opening a link** > > The experiment is private, wasn't shared with the account you are signed in with, or was deleted. Ask the owner to [share it](/dashboard/sharing) with you, or to make it public. > **My experiment or job doesn't appear** > > Check that the SDK is logged in with the API key shown on your Dashboard home. Then check which experiment is active: everything you create after `haiqu.init("name")` goes into that experiment. > **“You've used all your available credits”** > > Your credit balance is zero. To run more jobs, [request more credits](#credits). # Circuits Source: https://docs.haiqu.ai/dashboard/circuits Inspect a circuit's structure, cost and the jobs that ran it Each circuit has its own details page. To open it, click the **Details** arrow on any row in **Experiment Circuits** or in a job's **Circuits** list. ![Circuit details page](/images/dashboard/circuit.png) | Section | What it shows | | - | - | | Header | The circuit name (click to rename), its **Source** (for example *User* or *Transpiled*), and the target device for transpiled circuits | | Stats | **Qubit Count**, **2Q Depth**, and the total **QPU Cost** and **CPU Time** of all jobs that used this circuit | | **Gate Counts** | How many gates of each type the circuit has, plus any **Tunable Parameters** | | **Circuit Density Heat Map** | Gate activity per qubit (rows) and layer (columns). Hover over a cell for its value. Wide circuits scroll horizontally | | **Circuit Diagram** | A text drawing of the circuit, like `haiqu.draw` | | **Related Circuits** | The circuit this one was derived from, and circuits derived from it (for example, transpiled versions) | | **Jobs Using This Circuit** | Every job that ran this circuit, with the same actions as [All Jobs](/dashboard/jobs) | > [!TIP] > > To compare the original circuit with its transpiled or compressed versions, use the **Quantum volume** chart on the [experiment page](/dashboard/experiments#experiment-circuits). # Devices Source: https://docs.haiqu.ai/dashboard/devices Compare QPUs and simulators by queue, quality and price, and get a ready-to-run snippet **Devices** lists every QPU and simulator you can run on through Haiqu, across providers. ![Devices list](/images/dashboard/devices.png) | Column | Meaning | | - | - | | **Provider** / **Type** | Hardware vendor, and whether the device is a QPU or a simulator | | **Qubits** | Number of qubits on the device | | **Status** / **Queue** | Whether the device is available, and how many jobs are waiting | | **Quality** | Median 2-qubit gate error for QPUs (lower is better). For simulators, the noise model and qubit count | | **Price** | The provider's price per task and per shot, where available. You pay it to the provider; it is separate from your [Haiqu credits](/dashboard/account#credits) | | **Load (7 days)** | Queue depth over the last week | ## Device details Click a device to see its calibration summary: **Qubits**, **Queue Depth**, **2Q Error (Med)**, **Readout Error**, **T1**, **T2** and **Pricing**. The page has three tabs. **Overview** shows: * the device's basis gates, maximum qubits and **Quantum Volume**: 2n means the device reliably runs random circuits n qubits wide and n layers deep (higher is better) * the 7-day queue depth * recommended uses ![Device details overview](/images/dashboard/device.png) **Pricing** shows the pricing model, the cost per shot for common shot counts, and a **Cost Estimator**. Move the **Shots**, **Total Gates** and **Number of Circuits** sliders to estimate the cost of a run. These are the provider's charges, not Haiqu credits. ![Device pricing and cost estimator](/images/dashboard/device-pricing.png) **Getting Started** gives a Bell-state example with this device's ID already filled in. Click **Copy**, add your API key (and your provider credentials, where the snippet asks for them), and run it. ![Getting Started tab with a ready-to-run snippet](/images/dashboard/device-getting-started.png) > [!TIP] > > In the SDK, pick a device with `haiqu.get_device("")` and pass it to `haiqu.run`. See [Integrations](/integrations/ibm) for provider credentials. # Experiments Source: https://docs.haiqu.ai/dashboard/experiments Find, describe and compare your experiments, with their circuits, jobs and metrics An experiment groups everything for one piece of work. Calling `haiqu.init("name")` in the SDK creates an experiment, and every circuit and job you create after that belongs to it. See [Experiment tracking](/core_features/exp_tracking). ## My Experiments Open **My Experiments** in the sidebar to see all your experiments. ![My Experiments list](/images/dashboard/experiments.png) * **Search** by name, and filter by **Visibility** (Public, Shared, Private) or **Tags**. The filters are saved in the page URL, so you can bookmark or share a filtered view. * Click a column header to sort by **Created**, **Last activity**, **Circuits** or **Jobs**. * The icon at the end of each row shows who can see the experiment: public, shared or private. Click it to open the [share dialog](/dashboard/sharing). * Use **Export to CSV** to download the list. To delete experiments, select their rows and click **Delete (N)**. > [!WARNING] > > Deleting an experiment also permanently deletes all its circuits, jobs, comments and artifacts. ## The experiment page Click any experiment to open it. The page has a header, tags, a description, artifacts and metrics, then the experiment's circuits and jobs. ![Experiment page header, tags, description and artifacts](/images/dashboard/experiment.png) ### Header and tags * Click the title to rename the experiment. * The **Private** / **Shared** / **Public** button opens the [share dialog](/dashboard/sharing). * **Lab Notebook** opens the notebook this experiment was run from in Haiqu Lab, when one is linked. * Click **+** next to **Tags** to add a tag. Use tags to filter **My Experiments**. ### Description The description is a rich-text editor that saves automatically, so you can document what the experiment is for and what you found. Type `/` to open the block menu. You can add: * headings, lists and tables * multi-column layouts * **block** and **inline equations** in LaTeX: type `$$E = mc^2$$` on an empty line, or `$\epsilon_{2q}$` inside a sentence * images up to 2 MB To comment on part of the description, select text and click **Add comment**. See [Comments](/dashboard/sharing#comments). ### Artifacts and Logged Metrics What you log from the SDK appears here. How it is shown depends on what you log: | You log | It appears as | | - | - | | The same numeric metric several times | A **line chart** card. Click it to enlarge | | A pandas DataFrame | A **Table data** card. Click it to view, or use **Export to CSV** | | A matplotlib figure or an image | An **image** card. Click it to see it full size | | A single value (number, text) | A row under **Logged Metrics** | ![Artifacts: an image, a line chart and a table](/images/dashboard/experiment-artifacts.png) ![Table artifact opened in a dialog](/images/dashboard/experiment-table-artifact.png) * Click **+** next to **Artifacts** to upload a file of up to 2 MB. * Use the **…** menu on a card to **Rename** or **Delete** it. On table cards, **Insert into description** adds the table to the description. * Click a metric name under **Logged Metrics** to rename it. Hover over a metric to delete it. ### Experiment Circuits This table lists every circuit in the experiment: circuits you logged, plus transpiled and compressed versions. Each derived circuit appears under the circuit it came from. ![Experiment Circuits table and Quantum volume chart](/images/dashboard/experiment-circuits.png) * The columns show **Source**, target **Device**, **Estimated Fidelity**, **Active Qubits**, **Depth** and **Gates** (2-qubit and total). For depth and gate counts, lower is better: shorter circuits pick up less noise. * **Estimated Fidelity** (0–100%, higher is better) is an estimate made before any run; after a run, the closest measured counterpart is the job's **QPU Quality** (see [Jobs](/dashboard/jobs#metrics-in-the-table)). Its meaning depends on the source: * **Transpiled**: expected fidelity on the target device, from the device's noise characteristics. * **Compressed**: how closely the compressed circuit's state matches the original's. * **Data loading**: how closely the prepared state matches your data. * Circuits you logged yourself show 100%: there is no device or approximation to compare against yet. * Filter by name, **Source** or **Device**. Click a circuit name or description to edit it. * Use the row actions to show the jobs that used this circuit, or open its [details page](/dashboard/circuits). **Quantum volume** plots the selected circuits by 2-qubit depth and active qubits, colored by estimated fidelity. Pick a device in **Select device** to overlay its quantum volume (the shaded box) and an approximate volumetric frontier. Circuits inside the box or under the frontier are likely to run well on that device; the further a circuit sits beyond the frontier, the more its results degrade. Use the checkboxes in the table to choose which circuits are plotted. ![Quantum volume chart](/images/dashboard/experiment-quantum-volume.png) ### Experiment Jobs This list shows the experiment's jobs. It has the same columns and actions as [All Jobs](/dashboard/jobs). **Job Comparison** plots the selected jobs by QPU quality against **CPU Time** or **QPU Cost**. ![Experiment Jobs list](/images/dashboard/experiment-jobs.png) # Dashboard Home Source: https://docs.haiqu.ai/dashboard/home Your API key, compute credits and recent activity in one place The **Dashboard** is your starting point after sign-in. At a glance it tells you whether you are ready to run (API key and credits), what is happening (running and failed jobs), and what others have shared with you. ![Dashboard home page](/images/dashboard/dashboard.png) ## API key Connect the SDK to your account with the key shown at the top of the page: ```python theme={null} from haiqu.sdk import haiqu haiqu.login(api_access_key="") ``` ![API key field with show, copy and rotate buttons](/images/dashboard/dashboard-api-key.png) * Show API key / Hide API key show or hide the key * Copy API key copy it * Rotate API key rotate: issue a new key > [!WARNING] > > Rotating cannot be undone: the old key stops working at once and Haiqu Lab restarts. Update every script and `.env` file that uses it. ## Compute Execution Summary ![Compute Execution Summary with available and spent hours](/images/dashboard/dashboard-summary.png) **Available** and **Spent** are your compute credits, in hours. **Overview** counts your experiments and jobs. Click **Finished** or **Failed** to jump to those jobs in [All Jobs](/dashboard/jobs). > [!NOTE] > > When your credits run out, a banner at the top of the page links to a request form for more. See [Account & Credits](/dashboard/account#credits). ## Public experiments and Shared with me See what the community has published, or what teammates have shared with you. Switch with the **Public** / **Shared with me** toggle. ![Public experiments carousel](/images/dashboard/dashboard-public.png) ![Experiments shared with me](/images/dashboard/dashboard-shared.png) ## Devices, My Experiments, My Recent Jobs The rest of the page previews [Devices](/dashboard/devices), [My Experiments](/dashboard/experiments) and your most recent [jobs](/dashboard/jobs). # Jobs Source: https://docs.haiqu.ai/dashboard/jobs Track job status, read results and metrics, and fix jobs that fail or stall A job is created each time you run something: `haiqu.run(...)`, a transpilation, a data-loading or a hybrid program. **All Jobs** lists every job across all your experiments. ![All Jobs list](/images/dashboard/jobs.png) ## Statuses A job moves through these statuses. While any job is in progress, the list refreshes on its own every 15 seconds. | Status | What is happening | | - | - | | **Submitted** (orange) | The job is accepted and waiting for a Haiqu worker. A restarted job also returns here | | **Initializing** (orange) | A worker has picked the job up and is preparing the pipeline and the backend | | **Running** (orange) | Circuits have been sent to the backend. On a real QPU this includes the time spent in the **provider's queue**, so a job can stay here for a while | | **Done** (green) | Finished. Results and metrics are available | | **Error** (red) | Failed. **View Logs** shows the reason | | **Cancelled** (grey) | Stopped before it finished | ## Metrics in the table | Column | What it means | Better when | | - | - | - | | **QPU Quality** | How closely the QPU results match a classical simulation of the same circuit | Higher | | **CPU Time** | Classical compute Haiqu spent on the job: transpilation, compression, mitigation, post-processing. This is what your [Haiqu credits](/dashboard/account#credits) pay for | Lower | | **QPU Cost** | What the hardware provider charges for running the circuits. Estimated before the run (dotted underline), then updated to the actual cost. Paid to the provider, not from Haiqu credits | Lower | > [!NOTE] > > **QPU Quality** is empty for circuits with 20 or more qubits: it needs a classical simulation, which is not feasible at that size. An empty value is not an error. See [Job Performance Metrics](/core_features/quality). ## Find a job * **Search** by name, and filter by **Type**, **Status** or **Backend**. **Haiqu OS** groups jobs that don't target a QPU or simulator, such as transpilation or variational jobs. * Click a **Type** or **Backend** badge to filter by it. Hover over a job ID to copy it; click a name or description to edit it. ## Results and actions The icons at the end of each row: * **View input circuit(s)** / **View output circuit(s)**: the experiment's circuits, filtered to this job. * **View bitstrings**: **Job Results**, the measured bitstrings and their probabilities, most likely first. * **View observables**: for jobs that measure observables, **Job Results** shows the returned values as JSON. * **Details**: the job details page (Run jobs). * **…** menu: **View Logs**, **Cancel** (jobs in progress), **Restart** (jobs in **Error** or **Cancelled**), **Delete**. Both results views have **Export to JSON**.