Skip to main content
Create your own
Lesson illustration

Building VQE Ansätze

Hello! Welcome to the first lesson in our module on Variational Algorithms and Hamiltonian Simulation.

In the previous modules, we explored foundational quantum algorithms that often require fault-tolerant quantum computers. We now shift our focus to a class of algorithms designed for the noisy, intermediate-scale quantum (NISQ) devices available today: variational quantum algorithms.

Today's lesson addresses the learning outcome: Construct parameterized quantum circuits (ansätze) for the Variational Quantum Eigensolver (VQE).

VQE is a flagship hybrid quantum-classical algorithm used to find the ground state energy of a physical system, a fundamental problem in fields like quantum chemistry and materials science. The heart of VQE is the parameterized quantum circuit, or ansatz, which represents the trial quantum state. We will explore the principles behind designing these circuits, covering the two dominant strategies and the crucial trade-offs between them.

1. The Variational Quantum Eigensolver (VQE) Workflow

The VQE algorithm is based on the variational principle of quantum mechanics, which states that the expectation value of a Hamiltonian for any trial wave function is always greater than or equal to the true ground state energy :

In VQE, we choose a trial wave function that depends on a set of classical parameters . This parameterized trial state is called the ansatz. The goal is to find the parameters that minimize the energy expectation value:

This turns the quantum problem of finding a ground state into a classical optimization problem. The overall process is a hybrid loop:

  1. Classical: Choose an initial set of parameters .
  2. Quantum: Prepare the ansatz state on a quantum computer.
  3. Quantum: Measure the expectation value of the Hamiltonian, .
  4. Classical: Feed this energy value to a classical optimizer, which suggests a new set of parameters .
  5. Repeat until the energy converges to a minimum.

The diagram below illustrates this hybrid workflow. Our focus today is on step 2: how to design the circuit that prepares .

This schematic shows the VQE workflow. The quantum computer (yellow boxes) prepares the ansatz and performs measurements, while a classical computer (blue boxes) optimizes the ansatz parameters to minimize the measured energy.

To start, let's get a formal overview of VQE and the role of the ansatz. Please read the introduction of the following review paper.

VQE Method: A Short Survey and Recent Developments

This paper, 'VQE Method: A Short Survey and Recent Developments', provides a concise yet thorough introduction to VQE. It contextualizes the algorithm as a NISQ-friendly alternative to Quantum Phase Estimation (QPE) and introduces the two main categories of ansätze we will discuss.

Please read the 'Introduction to VQE' section (pages 3-5). Focus on understanding the overall VQE procedure, the form of the qubit Hamiltonian (Eq. 3), and the distinction made between 'chemistry-inspired' and 'hardware-efficient' ansätze.

As the paper highlights, the design of the ansatz is critical to the success of VQE. It determines the portion of the Hilbert space we can explore and directly impacts both the depth of the quantum circuit and the difficulty of the classical optimization. Let's delve into the two main design philosophies.

2. Problem-Inspired Ansätze

This approach uses knowledge from the problem domain—typically quantum chemistry—to construct the ansatz. The most prominent example is the Unitary Coupled Cluster (UCC) ansatz.

Your background in physics might make you familiar with classical coupled-cluster (CC) theory, a "gold standard" method in computational chemistry. UCC is its quantum computing counterpart. The ansatz is created by applying a unitary operator to a simple, easy-to-prepare reference state , which is usually the Hartree-Fock state:

The operator is the cluster operator, a sum of fermionic excitation operators weighted by the parameters .

  • represents single-electron excitations (promoting one electron from an occupied to a virtual orbital).
  • represents double-electron excitations.

Truncating this at singles and doubles gives the UCCSD ansatz.

Pros & Cons:

  • Pro: UCCSD is systematically improvable and provides a very accurate representation of the true ground state for many molecules. It encodes the underlying physics of electron correlation directly.
  • Con: When the fermionic operators in are mapped to qubit gates, the resulting quantum circuits are often extremely deep and require a large number of CNOT gates. This makes them impractical for current NISQ hardware.

Let's see a practical example of this depth problem.

Circuits in Quantum Algorithms - Circuit Sessions with Julien Gacon

This segment from a Qiskit video demonstrates the VQE algorithm for finding a molecule's ground state. It introduces the UCCSD ansatz and vividly illustrates how its circuit complexity explodes for a slightly larger molecule.

Please watch the section from 00:42:31 to 00:50:14. Pay close attention to the discussion on the UCCSD ansatz, its application to H₂, and the dramatic increase in circuit depth when moving to a larger molecule like LiH.

The challenge of deep UCCSD circuits has spurred research into more efficient problem-inspired ansätze. Two key directions are:

  1. Chemistry-Inspired Variants: Methods like k-UpCCGSD or OO-UCC aim to reduce the number of operators in the ansatz by simplifying the types of excitations, while trying to retain accuracy.
  2. Adaptive Ansätze: Methods like ADAPT-VQE build the ansatz iteratively. Instead of starting with a huge, fixed set of operators (like all singles and doubles), ADAPT-VQE starts with an empty ansatz and greedily adds the single operator from a predefined pool that provides the largest energy gradient. This "grows" a compact, problem-tailored ansatz.

To explore these advanced concepts, please refer back to the review paper.

VQE Method: A Short Survey and Recent Developments

The paper 'VQE Method: A Short Survey and Recent Developments' details several of these advanced, problem-inspired methods.

Please skim the section 'Chemistry-Inspired Ansatze' (pages 6-9) to get a sense of the different UCCSD variants. Then, read the section 'Adaptive Derivative-Assembled Pseudo-Trotter Ansatz Variational Quantum Eigensolver (ADAPT-VQE)' (pages 11-13) more carefully. This adaptive approach is a significant development in constructing efficient ansätze.

3. Hardware-Efficient Ansätze (HEAs)

The second philosophy takes the opposite approach. Instead of starting from the problem's physics, it starts from the quantum hardware itself. The goal is to create an ansatz that is easy to implement and has a shallow circuit depth, minimizing the impact of noise.

An example of a layered quantum circuit typical of a Hardware-Efficient Ansatz. It consists of alternating layers of single-qubit rotations and two-qubit entangling gates.

HEAs are typically constructed from repeating layers of two components:

  1. A layer of single-qubit rotation gates (e.g., , ). These gates are parameterized and serve as the "knobs" for the classical optimizer.
  2. A fixed layer of entangling gates (e.g., CNOTs or CZs). This block is designed to generate entanglement and explore the Hilbert space. Its structure is chosen to match the native gates and physical qubit connectivity (topology) of the target hardware to minimize gate errors.

The video below provides an excellent explanation of this concept.

Paper Review: Hardware-Efficient Variational Quantum Eigensolver for Small Molecules - Explained!

This Qiskit video explains the motivation and construction of Hardware-Efficient Ansätze, based on the original paper that introduced them. It clearly explains the layered structure, the importance of matching hardware topology, and the use of native gates like cross-resonance.

Please watch from 00:04:53 to 00:09:55. Focus on the contrast with problem-derived ansätze and the core principles of hardware-efficient design: layered structure, topology matching, and efficient gate choice.

To make this more concrete, the Qiskit library provides flexible templates for building HEAs. The TwoLocal circuit is a powerful tool for this.

Circuits in Quantum Algorithms - Circuit Sessions with Julien Gacon

This video segment introduces the TwoLocal circuit template in Qiskit, which is a general and practical way to construct a wide variety of hardware-efficient ansätze.

Please watch from 00:33:41 to 00:38:29. This will show you how to construct an HEA by specifying the rotation gates, entanglement gates, entanglement layout (e.g., linear, full), and number of repetitions.

The Challenge of HEAs: Barren Plateaus

While HEAs are designed to be NISQ-friendly, they come with a major theoretical challenge. Because they are not tailored to a specific problem, their structure can be too generic or "random." For such circuits, it has been shown that the gradient of the cost function can vanish exponentially as the number of qubits increases. This phenomenon, known as a barren plateau, makes the classical optimization intractable.

Recent research, however, has added crucial nuance. The trainability of an HEA is not just a property of the circuit itself, but also depends on the problem it is trying to solve. Specifically, it relates to the entanglement structure of the target ground state. Your physics background in many-body systems might give you an intuition for the concepts of "area law" and "volume law" entanglement.

  • Area Law States: Entanglement scales with the size of the boundary of a subsystem. Ground states of gapped, local Hamiltonians typically exhibit an area law.
  • Volume Law States: Entanglement scales with the volume of the subsystem. Highly excited states or states after a random evolution typically exhibit a volume law.

A recent paper has shown that shallow HEAs are trainable for tasks involving area-law states but suffer from barren plateaus for tasks involving volume-law states.

On the practical usefulness of the Hardware Efficient Ansatz

This recent paper, 'On the practical usefulness of the Hardware Efficient Ansatz', provides a framework for understanding when HEAs are likely to succeed or fail. It connects the trainability of the ansatz to the entanglement properties of the problem.

Please read the Abstract and the Popular Summary. This will give you the high-level takeaway: HEAs are not a universal solution, but they can be powerful in a 'Goldilocks' scenario where the problem data satisfies an area law.

4. Summary and Key Takeaways

The construction of an effective ansatz is a central challenge in VQE and an active area of research. There is no one-size-fits-all solution; the choice involves a critical trade-off.

Ansatz Type Pros Cons
Problem-Inspired Physically motivated, potentially higher accuracy with fewer parameters, systematically improvable. Often result in deep, complex circuits that are difficult to run on NISQ hardware.
Hardware-Efficient Shallow circuits by design, respects hardware constraints (topology, native gates), reducing errors. Can be difficult to train (barren plateaus), may require more parameters, less physically interpretable.

Key Takeaways:

  • The ansatz is a parameterized quantum circuit that prepares a trial state for the VQE algorithm.
  • Problem-inspired ansätze, like UCCSD, are derived from physical theory, offering high accuracy but often at the cost of deep circuits.
  • Hardware-efficient ansätze are built from repeating layers of simple rotation and entangling gates, prioritizing compatibility with NISQ devices but facing challenges like barren plateaus.
  • Advanced methods like ADAPT-VQE offer a compromise, building a problem-specific ansatz adaptively to keep circuits as compact as possible.
  • The choice of ansatz is a crucial, problem-dependent decision that balances physical accuracy against the practical limitations of current quantum hardware.

Preview of the Next Lesson

We have now seen how to construct the trial state . The next step in the VQE loop is to measure the energy . This requires expressing the physical Hamiltonian in a language the quantum computer understands. In our next lesson, we will cover exactly that: applying a mapping transformation (e.g., Jordan-Wigner) to express a Hamiltonian as a sum of Pauli strings.

Can't find a good explanation? Sign up and we'll make it for you

Sign up