Documentation Index
Fetch the complete documentation index at: https://docs.haiqu.ai/llms.txt
Use this file to discover all available pages before exploring further.
Variational optimization with Haiqu SDK
Usehaiqu.variational_optimization() to minimize the expectation value of an observable for a parameterized ansatz circuit.
Define the variational problem
VariationalProblem requires a parameterized ansatz circuit and a SparsePauliOp observable.API details
The variational optimisation function is defined as:| 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, typically NFTOptimizerOptions(...). |
use_mitigation | Enables mitigation pipeline in backend execution. |
use_session | Enables Qiskit Runtime Session mode. |
Optimizer details
Haiqu uses the NFT 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.
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), whereA_j^2 = I. -
Simple expectation-value cost: the objective should be a weighted sum of expectation values,
L(theta) = Σ_k w_k <phi_k|U†(theta) H_k U(theta)|phi_k>.
NFT can improve optimizer robustness, but it does not remove the fundamental sampling and noise-scaling challenges of variational quantum algorithms.