View on GitHub
Open this notebook in GitHub to run it yourself
The Adaptive Derivative-Assembled Pseudo-Trotter Variational Quantum Eigensolver (ADAPT-VQE) [1] is a variational hybrid algorithm, which constitutes an extension of the Variational Quantum Eigensolver (VQE) framework [2], that constructs problem-specific ansätze in a systematic and adaptive manner. Instead of relying on a fixed, heuristic circuit structure, ADAPT-VQE iteratively grows the state ansatz by selecting operators from a predefined pool based on their energy gradients with respect to the current variational state. At each iteration, the operator that yields the largest energy reduction is appended to the circuit and its parameters are reoptimized. This adaptive procedure significantly reduces the number of variational parameters and circuit depth, making ADAPT-VQE particularly well suited for near-term quantum hardware. Importantly, the algorithm is heuristic, leading to an approximate solution with no proven convergence guarantees. The algorithm treats the following problem:where is the number of qubits, is the total number of iterations, is the measurement cost to estimate a single operator gradient, is the number of optimizer steps at iteration , and is the measurement cost to estimate the energy once.Complexity: The major overhead generally comes from the evaluation of the elements of the energy gradient by repeated measurements of different observables. We therefore focus on the measurement complexity of the algorithm. The complexity depends on the chosen operator pool and classical optimization scheme. The total cost incorporates the two main components of the algorithm, (i) evaluating the energy gradient, and (ii) re-optimization of the current state-ansatz (corresponds to the standard VQE optimization). As a result, at each iteration step the cost is a sum of two terms, corresponding to the two algorithm components:
- Input: System Hamiltonian , reference state and an operator pool of anti-Hermitian operators .
- Output: Approximation of the ground state and energy of .
Keywords: Variational quantum algorithm, Chemistry, Optimization
Overview
The following notebook begins with a theoretical explanation of the algorithm. We then consider an explicit example, consisting of a system of four qubits. The ADAPT-VQE algorithm is employed to evaluate the ground state energy and state. Following, we provide a modified version of the algorithm, and the results of both versions of the ADAPT-VQE algorithms are compared to the results obtained by the standard VQE algorithm. The notebook concludes with a short summary and analysis of the algorithm and results.Algorithm steps
The algorithm builds and constructs the ansatz iteratively, one operator at a time, including only the most significant operators. This approach builds a minimal, problem-specific ansatz, avoiding unnecessary parameters and allowing systematic improvement of the accuracy. Similarly to VQE, the algorithms essentially reduce the circuit depth at the expense of measurements. Initially, we define an operator pool , containing a collection of anti-Hermitian operators that are employed in the ansatz construction. We then follow the following procedure:- Initialize the qubits to the reference state, , and define the initial iterative state as .
- Prepare a trial quantum state with the current ansatz, denoted by , where corresponds to the iteration step number (initially set to zero).
- Measure the commutator of the Hamiltonian with the operators of .
Implementation of ADPT-VQE with Classiq
We consider a simple example, consisting of a four-qubit system. The Hamiltonian and operator pool are defined in terms of the SparsePauliOp data structure, allowing for rapid and efficient algebraic computations. For implementation convenience, we consider an operator pool of Hermitian operators (instead of anti-Hermitian as in the theoretical derivation). In this case, the ansatz stat is of the form leading to the relation We begin by uploading software packages and utility functionsUtility functions
We employ utility functions form the ADAPT-QAOA notebook, used to efficiently compute the commutation of Pauli strings with theSparsePauilOp data structure.
These are used in the computation of .
The functions perform the following tasks:
sorted_pauli_termsorts Pauli terms according to the qubit’s index.commutatorreceives twoSparsePauilOps and returns their commutator as aSparsePauilOp.normalize_pauli_termremoves redundant Pauli identity operators, allowing for comparison and addition of twoSparsePauilOps.collect_pauli_termsadds up the coefficients of identical Pauli strings.
grad_energy function, which receives an operator, op, and Hamiltonian, hamiltonian, as SpasePauilOps, and evaluates the absolute value of the expectation value of the commutation relation with respect to an execution session es and optimization parameters params.
Defining the Example System and Operator Pool
Output:
Main program
Before defining the ADAPT-VQE main function, we first define theadapt_vqe_ansatz function, which prepares the product state of phases, , defined by the optimization parameters, thetas, and the associated operators of the operator pool, .
The function builds the state, phase by phase, utilizing a helper function adapt_layer.
The reference state is taken to be
where is the number of qubits.
k, (starting from ) until the gradient converges and satisfies tol. If the procedure does not converge, we limit the number of iterations by MAX_ITERATIONS.
Each iteration begins with a preparation of the ansatz state for the current .
The state preparation is performed by the first main quantum function, the quantum circuit is synthesized, and the optimization parameters are optimized by the es execution call and saved as a Python list in params.
The params parameters, along with the operators represented by the associated operator indices stored in the ansatz_ops, completely define the ansatz state.
Finally, the elements of the gradient, , are evaluated by the execution call using the grad_energy function. A convergence check is made; if the ansatz state converged or the number of iterations exceeds the limit, the iterative procedure is terminated; otherwise, the iteration cycle continues.
Output:
Results and Discussion
Optimized ansatz summaryOutput:
Energy graph

Convergence graph

Circuit Information
The circuit width and depth are:Output:
Summary ADAPT-VQE Ansatz
For the chosen operator pool and classical optimization algorithm, the optimal ansatz state has parameters converged to a result The ansatz operators, indexed by their associated index in the operator pool: . The optimization parameters are: The ansatz state can be constructed with a quantum circuit with a circuit width of and circuit depth of .Modified ADAPT-VQE Ansatz
We provide a modified version of the algorithm, where the algorithm starts with a pre-optimization with respect to a chosen operator. The algorithm showed improved results for the considered Hamiltonian and operator pool.Output:
Results and Discussion
Ansatz state summaryOutput:
Energy graph

Convergence graph

Circuit Information
The circuit width and depth are:Output:
Summary Modified ADAPT-VQE Ansatz
For the chosen operator pool and classical optimization algorithm, the optimal ansatz state has parameters converged to a result The ansatz operators, indexed by their associated index in the operator pool: . The optimization parameters are: The ansatz state can be constructed with a quantum circuit with a circuit width of and circuit depth of .Comparison to the VQE algorithm
We now validate the results of the ADAPT-VQE by comparing them to the outcome of the standard VQE algorithm with ten optimization parameters (), and picking the operator pool as the first ten even indices (the choice is arbitrary and independent of the Hamiltonian). We fix the ansatz state by considering a product form of phases, where , for the presented test case. The operators are determined by their operator pool indices invqe_ansatz_ops_indicies and the associated parameters are optimized by applying the VQE algorithm.
Output:
Circuit Information
Output: